Graph linear inequalities on a number line
Enter an inequality such as 2x + 3 < 11 and see how to draw it: the answer x < 4, an open circle at 4, shading to the left and the interval (-∞, 4). A negative coefficient flips the sign for you. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- A
- 2
- B
- 3
- C
- 11
- Relation
- <
- Inequality
- 2*x + 3 < 11
- Precision
- 10
- Boundary
- 4
- Solution relation
- <
Graphing a linear inequality on a number line means more than solving for x. You also need to know where the boundary point sits, whether it belongs to the solution (a closed circle) or not (an open circle), and which direction to shade. This capability takes the coefficients and the relation symbol of a one-variable linear inequality in the form a*x + b ⊙ c and returns exactly that: the solution in interval notation plus the complete graphing recipe for the number line.
From coefficients to a graphable answer
A one-variable linear inequality looks like a*x + b < c, with < replaced by <=, > or >= depending on the problem. Solving it means isolating x, and graphing it means translating that solution into marks on a number line. When a is negative the relation flips, because dividing an inequality by a negative number reverses its direction; the response tells you explicitly whether that flip happened.
The result includes the boundary value, the solved form such as x > -4, the interval notation, and a nested graph object describing how to draw the answer. Nothing is sampled, estimated or randomized: the same input always produces the same output, which is what makes the response safe to cache, to test against, and to feed straight into a renderer that draws the number line for a student or a report.
Reading the number-line graphing fields
The graphing output answers the three questions anyone asks when drawing the solution on a number line. First, where is the boundary: the boundary field gives the exact point, already rounded to the requested precision. Second, is the boundary included: the circle field is either open or closed.
Strict relations (< and >) produce an open circle, because the boundary itself is not a solution; inclusive relations (<= and >=) produce a closed circle, because it is. With those fields a client can render the classic textbook graph — circle on the boundary, arrow or bold segment running toward the correct infinity — without re-deriving any of the algebra itself.
What you can do with it
Render homework feedback instantly
A tutoring app sends the student's inequality coefficients and gets back the boundary, circle style and shading direction needed to draw the correct number-line graph next to the student's attempt.
Generate worksheet answer keys
A teacher batches inequalities of the form a*x + b ⊙ c and receives interval notation plus graphing instructions for each, ready to typeset into an answer key without solving anything by hand.
FAQ
What does it cost?
The same code also runs free in your browser on this page.
What happens when a is negative?
The inequality is divided by a and the relation flips direction, as the algebra requires. The response sets flipped to true and reports the solution with the corrected relation.
What happens when a is zero?
The inequality no longer depends on x. If b ⊙ c is true, the solution is all real numbers and the whole line is shaded; if it is false, there is no solution and the graph is empty.
How do I know whether to draw an open or closed circle?
Read the circle field: open for strict relations (< and >), closed for inclusive ones (<= and >=).
Is the output deterministic?
Yes. It is pure arithmetic with fixed rounding — no clock, no randomness, no network — so identical inputs always return identical outputs.
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/math/graphing-inequalities-1d \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":2,"b":3,"c":11,"relation":"<"}'const res = await fetch("https://api.kit.forhosting.com/math/graphing-inequalities-1d", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": 2,
"b": 3,
"c": 11,
"relation": "<"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/graphing-inequalities-1d",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": 2,
"b": 3,
"c": 11,
"relation": "<"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/graphing-inequalities-1d", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":2,"b":3,"c":11,"relation":"<"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":2,"b":3,"c":11,"relation":"<"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/graphing-inequalities-1d", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"a": 2,
"b": 3,
"c": 11,
"relation": "<"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.graphing_inequalities_1d",
"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
It handles the negative-coefficient flip and the a = 0 edge cases, and the same deterministic code runs free in your browser and through the paid API.
From coefficients to a graphable answer
This endpoint accepts the four pieces of the puzzle — the coefficient a, the constant b, the right-hand side c, and the relation symbol — and does both jobs in one deterministic step. It first subtracts b from both sides, then divides by a.
Reading the number-line graphing fields
Third, which way does the shading go: shading_direction is left for solutions of the form x < boundary or x <= boundary, and right for x > boundary or x >= boundary. A compact ASCII number_line string sketches the same information for quick inspection in logs or chat, using a filled or hollow marker and a shaded segment on the correct side.
Edge cases: negative coefficients and a equal to zero
Two situations trip up hand solutions, and both are handled explicitly. The flipped flag in the response records that this happened, so a teaching tool can highlight the step where the direction changed. When a is exactly zero, the term with x disappears and the inequality reduces to a bare comparison between b and c. When a is negative, dividing both sides by a reverses the relation: -2x + 3 < 11 becomes x > -4, not x < -4. If that comparison is true, every real number is a solution: the response reports all real numbers, the interval (-∞, ∞), and shading_direction set to all, meaning the whole number line is shaded. If it is false, no value of x can satisfy the inequality: the response reports no solution, the empty interval ∅, and shading_direction set to none. These degenerate cases still return the same field shape as ordinary solutions wherever that is meaningful, so callers never have to special-case a missing boundary except where a boundary genuinely does not exist.
Integration use cases
Drive an interactive number-line widget
A learning platform feeds the graph object straight into its canvas component: circle at boundary, open or closed, shaded toward the stated direction, with the interval as an accessible caption.
Technical questions
Which relation symbols are accepted?
Exactly <, <=, > and >=. Any other symbol is rejected with an invalid_input error that names the relation field.