Linear Equation Solver

Enter the coefficients a, b, c, and d of ax + b = cx + d to solve for x.

a·x + b = c·x + d

Solution
—
Exact rational solution
—
Derivation
—

Coefficients may be signed decimals or fractions such as 1/3. Decimal comma and Unicode minus are accepted. The equation reduces exactly to (a−c)x=d−b; a zero coefficient gives either no solution or all real x. Decimal output is rounded to 12 significant digits; the fraction and derivation stay exact. Set c=d=0 for ax+b=0.

How this linear equation is solved

To solve ax + b = cx + d for x, first move all the x terms to one side and the constants to the other: ax − cx = d − b, which simplifies to (a − c)x = d − b. Dividing both sides by (a − c) gives x = (d − b) / (a − c).

This only works when a and c are different — if a equals c, the x terms cancel out entirely, leaving either a true statement (b equals d, so every x works) or a false one (b doesn't equal d, so no x works).

Coefficients may be signed decimals or fractions such as 1/3. Decimal comma and Unicode minus are accepted. The equation reduces exactly to (a−c)x=d−b; a zero coefficient gives either no solution or all real x. Decimal output is rounded to 12 significant digits; the fraction and derivation stay exact. Set c=d=0 for ax+b=0.

Frequently asked questions

What does it mean when there's no solution?

It means the equation simplifies to a false statement, like 5 = 8 — no value of x can make both sides equal, because the equation describes two parallel lines that never intersect.

What does it mean when there are infinite solutions?

It means both sides of the equation are actually the same line, so every value of x satisfies the equation equally.

How do I solve a simpler equation like ax + b = 0?

That's the same equation with c = 0 and d = 0, so you can use this calculator directly with those values.

How we verified this calculator

The calculator is checked against 3 reference cases computed independently of its code. Last passed: .

# Inputs Expected result
1
a = 5
b = -2
c = 3
d = 7
Exact rational solution: x = 9/2
2
a = 3
b = 0
c = 5
d = 8
Exact rational solution: x = -4
3
a = 1/3
b = 1/4
c = -1/2
d = 2
Exact rational solution: x = 21/10

How we test our calculators →

Also try:

Back to category →