Compound inequality solver
−2x + 4 < 8 and 3x − 1 ≤ 11 together give (−2, 4]: enter both inequalities, say whether both must hold or either one is enough, and get the combined interval, even when it is empty or split in two. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Join
- And
- A1
- -2
- B1
- 4
- C1
- 8
- Op1
- <
- A2
- 3
- Bound1
- -2
- Solution op1
- >
- Inequality1
- -2x + 4 < 8
- Solution1
- x > -2
A compound inequality joins two statements about the same unknown with and or or. The and case is the intersection of the two solution sets: every accepted x must satisfy both linear comparisons at once. The or case is the union: x is allowed to satisfy either comparison, including both when they overlap. Students meet both forms in algebra one when they write pairs such as two x plus three less than seven and x minus one greater than zero, or when they write a split such as x less than two or x greater than five. This compound inequality solver isolates x in each linear piece ax plus b compared with c, flips the comparison whenever a coefficient is negative, then intersects or unites the resulting rays and returns the combined answer in interval notation. Empty intersections become the empty-set symbol; overlapping or adjacent or-rays that cover every real become the whole line; disjoint or-rays stay a two-piece union.
What a compound inequality is and how and versus or change the set
A compound inequality is not a single comparison and not a notation rewrite of an already-isolated x. It is two linear statements about the same variable, joined by a logical connector that decides whether both must hold or whether either is enough. In classroom language, and means the overlap of the two solution sets: if the first piece says x is greater than negative two and the second says x is at most four, the combined answer is the open-closed window from negative two to four.
Or means the coverage of either set: if the first piece says x is less than two and the second says x is greater than five, the combined answer is the disjoint union of a left ray and a right ray. Those two pictures look nothing alike on a number line, which is why a dedicated compound inequality solver exists instead of asking a student to run a single linear solver twice and combine the rays by hand.
Each piece here has the genuine linear form a x plus b compared with c, so a negative slope still reverses the inequality when both sides are divided—the same flip rule taught in algebra one. After isolation, every piece is a half-line. Intersecting two half-lines can yield a bounded interval, a tighter ray, a singleton when both ends close on the same number, or the empty set when the rays miss each other.
Input contract, the flip rule, and how the two rays are combined
The first piece uses a1, b1, c1, and op1 for a1 x plus b1 compared with c1; the second piece uses a2, b2, c2, and op2. Each coefficient must be a finite number, and a1 and a2 must be non-zero because a zero slope would make that piece independent of x and no longer a linear inequality in the unknown.
Operators may be written as symbols less than, less than or equal, greater than, or greater than or equal, or as the short codes lt, le, gt, and ge, including the unicode less-or-equal and greater-or-equal glyphs. Optional precision from zero through fifteen decimal places rounds coefficients and bounds before the set algebra so goldens stay stable across runtimes; the default of ten matches other tier-A algebra helpers. After subtracting the constant, both sides of each piece are divided by the slope.
A positive slope keeps the original operator. A negative slope reverses it, and the response sets flipped1 or flipped2 so a teaching layer can highlight that step. The engine then intersects the two rays when join is and, or unites them when join is or.
Where a compound inequality solver belongs in study, teaching, and code
Students meet compound inequalities when a word problem demands a range that satisfies two constraints at once, such as a budget that must stay below one limit and above another, and when a split condition says a reading is either too low or too high. Teachers can generate answer keys that show the isolated rays, the flip on a negative coefficient, and the final interval without trusting opaque calculator apps that forget the connector or print scientific notation.
Contest practice often needs a fast offline check that an empty intersection is truly empty and that an or of overlapping rays is the whole line rather than a sloppy union of two intervals that actually cover everything. This page is a different search intent from a single linear inequality solver, which isolates one comparison and stops, and from an interval-notation converter, which starts from an already-isolated x compared with a bound or from a chain that is already written as lower related to x related to upper.
Here the work is the solve-then-combine step that those tools leave to the human. On this page the calculation runs entirely in your browser.
What you can do with it
Homework and number-line checks
Solve two linear pieces joined by and or or, verify the flip on a negative slope, and copy the combined interval into an answer key.
Teaching the connector, not just the bound
Show flipped1 or flipped2 when a coefficient is negative, then shade the overlap for and or the two-piece union for or.
FAQ
What does the compound inequality solver cost?
It is free in your browser on this page.
How is a compound inequality solved here?
Each piece a x + b ⊙ c is isolated for x (the comparison flips when a is negative). And intersects the two rays; or unites them. The combined set is returned in interval notation.
What is the difference between and and or?
And is the intersection: x must satisfy both pieces. Or is the union: x may satisfy either piece. Overlapping or-rays can cover the whole real line; missing and-rays yield the empty set.
Why must a1 and a2 be non-zero?
A zero slope makes that piece independent of x, so it is not a linear inequality in the unknown.
How is this different from a single inequality solver or an interval converter?
A single solver isolates one comparison and stops. An interval converter starts from an already-isolated x ⊙ bound or lower ⊙ x ⊙ upper. This solver isolates two linear pieces and then intersects or unites their solution sets.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/algebra/compound-inequality \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"join":"and","a1":-2,"b1":4,"c1":8,"op1":"<","a2":3,"b2":-1,"c2":11,"op2":"<="}'const res = await fetch("https://api.kit.forhosting.com/algebra/compound-inequality", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"join": "and",
"a1": -2,
"b1": 4,
"c1": 8,
"op1": "<",
"a2": 3,
"b2": -1,
"c2": 11,
"op2": "<="
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/algebra/compound-inequality",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"join": "and",
"a1": -2,
"b1": 4,
"c1": 8,
"op1": "<",
"a2": 3,
"b2": -1,
"c2": 11,
"op2": "<="
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/algebra/compound-inequality", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"join":"and","a1":-2,"b1":4,"c1":8,"op1":"<","a2":3,"b2":-1,"c2":11,"op2":"<="}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"join":"and","a1":-2,"b1":4,"c1":8,"op1":"<","a2":3,"b2":-1,"c2":11,"op2":"<="}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/algebra/compound-inequality", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"join": "and",
"a1": -2,
"b1": 4,
"c1": 8,
"op1": "<",
"a2": 3,
"b2": -1,
"c2": 11,
"op2": "<="
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "algebra.compound_inequality",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_abs_coeff | 1000000000000000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
The same deterministic module powers the free browser tool and the API path at $0.002 per successful call.
What a compound inequality is and how and versus or change the set
Uniting two half-lines can yield a wider ray, the whole real line when the rays overlap or touch through an included endpoint, or a two-piece union when a gap remains. Interval notation then packages that set: parentheses exclude an endpoint, square brackets include it, infinity markers never take a square bracket, the empty set is the empty-set symbol, and a disjoint pair is written with a union sign. That is the contract this page answers: solve, combine, and print the interval, not merely decorate a bound that the caller already isolated.
Input contract, the flip rule, and how the two rays are combined
Send a JSON body with join set to and or or, plus two complete linear inequalities. Aliases such as connector and combine for join, left_a and right_a for the slopes, and left_op and right_op for the comparisons are accepted so spreadsheets and typed forms can reuse the same contract. The payload echoes both original inequalities, both isolated solutions, both individual intervals, and the combined interval string, together with a kind flag of empty, all_reals, interval, or union, piece counts, and an unbounded flag. Finite endpoints of a single connected result are included as lower and upper with inclusive flags; those keys are omitted—not set to null—when the result is empty, the whole line, or a two-piece union. Missing fields, non-finite numbers, unknown operators, magnitudes above the documented ceiling, and a zero slope all fail with invalid_input and are not billed.
Where a compound inequality solver belongs in study, teaching, and code
Through the API each successful solve costs $0.002, failed validation is not charged, and nothing is stored after the response returns.
Integration use cases
Deterministic grading fixtures
Generate reproducible intersections, unions, empty sets, and whole-line results for quizzes and CI without hand-maintaining interval tables.