A compound inequality is two inequalities glued together with the word AND or the word OR. Which word you use changes everything about the answer. With AND, the solution must satisfy both pieces — you keep only the overlap. With OR, satisfying either one is enough — you keep the combined shading. That is literally intersection versus union of sets, and the picture on the number line is the fastest way to see it.

This visualiser gives you two intervals you can drag, a toggle that flips between AND and OR, and a shaded region that is always the current compound solution. The readout turns the picture back into interval notation so you can match what you see to what you would write on paper.

The widget

Move the four endpoint sliders to set two intervals A and B on the number line. Click the toggle to switch between AND (intersection A \cap B) and OR (union A \cup B). The shaded lavender band shows the two individual intervals; the orange band on top shows the compound solution.

Top band: interval $A$. Middle band: interval $B$. Bottom band: the compound solution — intersection when mode is AND, union when mode is OR. The interval-notation readout updates live.

How to read the three rows

The widget stacks three number lines vertically. The top two rows show the input intervals — A in lavender and B in blue — with each colour band stretching between the endpoints you choose. The bottom row shows the output: the compound solution, shaded in orange, under the heading A \cap B or A \cup B depending on the toggle.

Everything you see in the bottom row is derived from the top two. There is nothing to compute by hand. If you slide A's right endpoint leftward, watch the orange overlap shrink in AND mode and the orange union follow in OR mode. If you slide B entirely past A, the AND overlap vanishes and the OR band splits into two disconnected pieces. That direct cause-and-effect — move a piece, see the compound solution rearrange itself — is the point of having the widget rather than just a static picture. Compound inequalities are dynamic objects; the visualiser lets you feel that.

The interval-notation readout at the bottom right is the algebra version of what you see. When the AND overlap is non-empty, it reads like [a, b]. When it is empty, it reads \varnothing. When the OR union is a single merged band, it reads like [a, b]; when it is two disjoint bands, it reads like [a, b] \cup [c, d] with the union symbol between them. Match the picture to the notation and the notation stops being cryptic.

AND as intersection

When two inequalities are joined by AND, a number x is in the solution set only if it satisfies both. In set language, that is the intersection:

\{x : P(x) \text{ and } Q(x)\} \;=\; \{x : P(x)\} \cap \{x : Q(x)\}

The compact double-inequality notation a < x < b is the most common AND you will meet. It is shorthand for "x > a AND x < b", and its solution is the interval (a, b) — exactly the overlap of the rays (a, \infty) and (-\infty, b).

Worked example: solve x > 2 AND x < 5

Each part on its own is easy. x > 2 is the ray (2, \infty). x < 5 is the ray (-\infty, 5). The AND keeps only the numbers that are in both rays: greater than 2 and less than 5. On the visualiser above, set A = (-10, 5]-ish and B = [2, 10]; the orange overlap sits between 2 and 5.

Algebraically you just stack the conditions:

2 < x \quad\text{and}\quad x < 5 \;\;\Longleftrightarrow\;\; 2 < x < 5

So the solution is the open interval (2, 5).

When AND gives the empty set

If the two conditions point in incompatible directions, the intersection is empty. For example, x > 6 AND x < 3 has no solution — no real number is simultaneously bigger than 6 and smaller than 3. On the visualiser, drag the intervals so they do not touch and flip to AND: the compound row goes blank and the readout says \varnothing.

When AND is a double-sided absolute value

An inequality like |x - 3| \le 2 is secretly an AND. It unpacks to:

-2 \le x - 3 \le 2 \;\;\Longleftrightarrow\;\; (x - 3 \ge -2) \text{ AND } (x - 3 \le 2)

which is 1 \le x AND x \le 5, giving [1, 5]. Every "distance less than r" inequality from the parent article is an AND in disguise.

A safety check for AND

When you solve an AND problem, stop and ask: does the overlap even exist? If you have x \ge 5 AND x \le 2, stacking the inequalities gives the impossible 5 \le x \le 2, which should ring the alarm immediately. A quick picture with the visualiser makes the empty intersection obvious — there is nothing to shade orange. On paper, the rule of thumb is: for AND to have solutions, the right endpoint of the "left side" ray must lie to the right of the left endpoint of the "right side" ray. If it doesn't, the answer is \varnothing.

OR as union

When two inequalities are joined by OR, a number x is in the solution set if it satisfies at least one. In set language, that is the union:

\{x : P(x) \text{ or } Q(x)\} \;=\; \{x : P(x)\} \cup \{x : Q(x)\}

Two things make OR harder to handle on paper than AND:

  1. The solution is often two disconnected pieces, so the answer looks like (-\infty, a] \cup [b, \infty) rather than a single interval.
  2. If the two pieces happen to overlap, you collapse them back into one. (-\infty, 3) \cup (2, \infty) is just \mathbb{R}, because every real number is either less than 3 or greater than 2 (or both).

The visualiser handles the collapse automatically: when the two input intervals overlap, the orange union is a single band; when they don't, it is two bands with a gap between them.

Worked example: solve x \le 1 OR x \ge 4

The first ray is (-\infty, 1]. The second ray is [4, \infty). Together:

(-\infty, 1] \cup [4, \infty)

On the visualiser, set A to cover the left side and B to cover the right side, then flip to OR: the compound row is two bands with a gap from 1 to 4.

This pattern — two rays with a gap — is the signature of a "distance greater than r" inequality. For example, |x - 2.5| \ge 1.5 unpacks to x - 2.5 \le -1.5 OR x - 2.5 \ge 1.5, giving exactly (-\infty, 1] \cup [4, \infty).

When OR swallows the whole line

Try setting A = [-10, 3] and B = [-2, 10] on the visualiser, then flip to OR. The two bands overlap in the middle, so their union collapses to a single band [-10, 10] — the entire visible range. Push the endpoints further and you can see the same collapse happen whenever the rays touch or cross. Algebraically this is the rule "if the pieces overlap, merge them into one interval with the outer endpoints." The readout does the merge for you, which is useful for spotting mistakes: if you expected two intervals and the readout shows one, your two conditions actually overlap.

A common real-world OR

A cinema chain offers a student discount to anyone who is at most 18 years old OR at least 60. The set of ages that qualify is [0, 18] \cup [60, \infty). No single inequality captures this — you need the OR because the qualifying ages are two disjoint pieces of the number line. The visualiser makes this immediate: slide A and B to the two age bands and the orange union is exactly the set of discount-eligible ages.

Reading the compound notation

Once you see AND as \cap and OR as \cup, the interval-notation conventions become mechanical:

The widget lets you probe every combination. Slide A and B until they just touch at a point, then flip between AND and OR. In AND you get a single point (or the empty set if the touch is strict); in OR you get the whole merged interval.

A slightly harder example: AND with absolute values

Solve |x + 1| \le 3 AND |x - 4| \ge 2. The first inequality unpacks to -3 \le x + 1 \le 3, i.e., -4 \le x \le 2, which is the interval [-4, 2]. The second unpacks to x - 4 \le -2 OR x - 4 \ge 2, giving (-\infty, 2] \cup [6, \infty).

Now take the AND. You need x to be in both [-4, 2] and (-\infty, 2] \cup [6, \infty). Since the second set is a union, distribute the intersection: [-4, 2] \cap (-\infty, 2] = [-4, 2] and [-4, 2] \cap [6, \infty) = \varnothing. The final answer is [-4, 2].

The visualiser can't model an AND-of-OR-of-ANDs directly, but you can verify step by step: first set A = [-4, 2] and B = (-\infty, 2] and flip to AND — the overlap is [-4, 2]. Then try B = [6, \infty) — the overlap is empty. The union of the two overlaps is [-4, 2], matching the algebra.

The set-theoretic punchline

The words "AND" and "OR" in everyday language are the same words logicians use, and the number-line picture is the same picture set theorists draw. When you write

x \in A \cap B \quad\text{vs.}\quad x \in A \cup B

you are saying the same thing that an algebra student says with "AND" and "OR". The only difference is the medium — a Venn diagram in set theory, a shaded number line in algebra — but the content is identical. That is the structural connection the visualiser makes concrete: intersection and union are not just set-theory vocabulary; they are compound inequalities, seen from above.

Come back to this widget when quadratic inequalities like (x - 2)(x - 5) > 0 or rational inequalities like \frac{1}{x - 1} > 0 force you to stitch together multiple sign intervals with AND and OR. The shading on the number line is always the final answer, and this tool trains your eye to read it without thinking.

De Morgan, visually

There is one last pattern the widget makes concrete. If the AND of two simple conditions gives an interval, then the negation of that AND is an OR of the opposite conditions. Concretely, "not (x > 2 AND x < 5)" is "x \le 2 OR x \ge 5". On the number line, that is the complement of the AND shading — the un-orange region, which is exactly a union of two rays. This is De Morgan's law in number-line form: complementing swaps AND with OR and swaps each condition with its negation. Test it with the visualiser: set two overlapping intervals, note the intersection in AND mode, then imagine the region outside that intersection and check that it matches the OR of the complementary intervals.

Keep this in your head when you meet system-of-inequalities problems in JEE: writing the solution as a small AND is often easier than writing the complement as a big OR, but they describe the same picture from opposite sides.