Absolute value equation solver
An absolute value equation like |2x − 4| = 10 looks small but hides a fork: the expression inside the bars can be either positive or negative, so one equation is really two linear equations in disguise.
Run — free
This absolute value equation solver takes the three coefficients a, b and c of |ax + b| = c and returns every real solution, distinguishing the four cases that matter: two solutions, exactly one, none at all when c is negative, and infinitely many when a is zero and |b| equals c. It runs deterministically, with no approximation methods, so the answer you test in the browser is the same answer the API returns.
Why one equation becomes two
The absolute value of a number is its distance from zero, so saying |ax + b| = c really says the quantity ax + b sits exactly c units away from zero. When c is positive, that happens in two places: ax + b = c or ax + b = −c. Each branch is an ordinary linear equation, solved by isolating x, which gives x = (−b + c)/a on one side and x = (−b − c)/a on the other. The absolute value equation solver performs exactly this split for you, then sorts the two roots ascending so the output is stable and easy to compare against a textbook answer. Take |2x − 4| = 10: the branches are 2x − 4 = 10 and 2x − 4 = −10, giving x = 7 and x = −3. Both are returned, and you can verify each by substituting it back into the original expression. This is the same procedure taught in algebra courses, just executed without sign slips: the most common student mistake is forgetting the negative branch entirely, which loses half the solution set. Automating the split removes that whole class of error.
The edge cases: one solution, none, or infinitely many
Not every absolute value equation has two answers, and a solver that always returns two roots is wrong often enough to be dangerous. When c equals zero, the two branches collapse into the single equation ax + b = 0, so there is exactly one solution at x = −b/a; |x + 3| = 0 is satisfied only by x = −3. When c is negative, there is nothing to find at all: an absolute value is a distance and a distance cannot be negative, so |3x + 1| = −2 has no real solutions, and the solver says so with an empty list rather than inventing numbers. The trickiest case is a = 0, where x disappears from the equation entirely. If |b| happens to equal c, every real number is a solution and the solver reports infinitely many; otherwise the equation is a contradiction like |5| = 3 and the call is rejected as invalid input, because a coefficient set that cannot involve x is a modelling mistake, not a solvable problem. Covering these four cases explicitly is what separates a correct solver from a quadratic-formula-style guess.
Using the API and interpreting the output
You send three numbers — a, b and c — and receive the reconstructed equation, the coefficients echoed back, and the solution set. The solutions field is a list of real numbers rounded to ten decimal places so that results are byte-identical across machines and safe to snapshot in tests; solution_count tells you how many there are without counting elements. When the solution set is empty you still get a successful response with an empty list, because 'no real solutions' is a valid mathematical answer, not an error. When a is zero and |b| equals c, the response carries infinite_solutions instead of a list. Only genuinely malformed requests are rejected: a missing or non-numeric coefficient, a non-finite value like Infinity, or the contradictory a = 0 case described above. The capability runs on our edge with nothing stored, and the identical code powers the free widget on this page, so you can prototype by hand and only pay — $0.002 per call — once you wire it into a pipeline. Typical integrations are tutoring backends checking student answers, symbolic pre-processors, and validation of generated exercise sets.
What you can do with it
Check homework answers automatically
A tutoring app sends a, b and c from each generated exercise and compares the student's answer against the exact solution set.
Validate generated exercise sets
A content pipeline rejects any generated |ax+b|=c item that accidentally has no real solutions or a degenerate a = 0 before it reaches students.
Solve tolerance problems in engineering
Equations like |x − target| = tolerance appear in calibration and machining; get the boundary values directly from the coefficients.
FAQ
What does it cost?
$0.002 per request via the API. It is also free to run in your browser on this page.
What forms of equation does it accept?
Exactly |ax + b| = c, given as the three numeric coefficients a, b and c. Rearrange other forms into this one first.
What happens when c is negative?
The call succeeds and returns an empty solution list: an absolute value cannot equal a negative number, so there are no real solutions.
What happens when a is zero?
If |b| equals c, every real number is a solution and the response reports infinitely many. Otherwise the coefficients are contradictory and the request is rejected as invalid input.
Are the results exact?
Yes. The solve is a direct algebraic rearrangement with no iterative approximation; roots are rounded to ten decimal places only so results are identical on every machine.
Is anything I send stored?
No. The three coefficients are processed in memory and discarded; only the solution set is returned.
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/absolute-value-equation \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":2,"b":-4,"c":10}'const res = await fetch("https://api.kit.forhosting.com/math/absolute-value-equation", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": 2,
"b": -4,
"c": 10
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/absolute-value-equation",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": 2,
"b": -4,
"c": 10
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/absolute-value-equation", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":2,"b":-4,"c":10}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":2,"b":-4,"c":10}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/absolute-value-equation", 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": -4,
"c": 10
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.absolute_value_equation",
"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.
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. |