Linear equation calculator

Type coefficient a and constant term b of ax + b = 0. You want the one x that makes the left side zero. With a = 2 and b = 6 you get x = -3, because 2·(-3) + 6 = 0.

When a = 0 the equation has no single x. The result is a blank result. The fields start at zero and go up.

Input data

Results

Enter data and click Calculate.

How it works

The linear equation in this calculator is ax + b = 0. You move b to the other side and divide by a: x = -b / a. With a = 2 and b = 6 you get x = -3. With a = 5 and b = 15 you also get x = -3, because that is the same slope after cancelling.

Coefficient a is the slope of the line y = ax + b. You want the place where that line crosses the x-axis, so y = 0. The constant term b lifts or drops the line. With b = 0 and a = 4 you get x = 0, a crossing at the origin.

When a = 0 there is nothing to divide by. If b is also zero, every x would satisfy 0 = 0, but the calculator still leaves a blank result. If b is not zero, 0·x + 5 = 0 has no solution. There is no extra message here, only an empty field.

The labels are coefficient a and constant term b. The form starts at zero and goes up. Type 2 and 6, then click Calculate. A comma and a dot are the same decimal: 4 and 2 give x = -0.5.

A quadratic equation adds x² and a discriminant. There is no parabola here. The value y = ax + b at a chosen x lives on the linear-function card, not here.

a = 1, b = 0 gives x = 0. a = 4, b = 2 gives x = -0.5. a = 3, b = 9 gives x = -3. a = 0 stays blank, whatever b is.

Formula

x = -b / a, when a ≠ 0

How to use

  1. Type a, for example 2, and b, for example 6.
  2. Click Calculate. x = -3, because 2·(-3) + 6 = 0.
  3. a = 5 and b = 15 also give x = -3.
  4. a = 0 leaves a blank result. There is no single x.
  5. When you need x², open the quadratic equation. This calculator stays a line.

x = -b / a

The linear equation ax + b = 0. With a = 2 and b = 6 you get x = -3. When a = 0 the calculator does not return an x.

coefficient
a next to x. You divide by it. a = 0 leaves a blank field, not a new x.
constant
b with no x. It sits in the numerator as -b. With a = 2 and b = 6 it gives -3.
a
The slope of the line. With b = 6 and a = 2 you get x = -3. Zero a does not pass.

Examples

Example 1

  • a = 2
  • b = 6

-3

What x solves 2x + 6 = 0? x = -3.

Example 2

  • a = 5
  • b = 15

-3

Is 5x + 15 = 0 the same x? Yes, -3.

Example 3

  • a = 4
  • b = 2

-0.5

What x solves 4x + 2 = 0? x = -0.5.

Related calculators

Common questions

What x solves 2x + 6 = 0?

x = -3. The formula is x = -b / a, here -6 / 2. Check: 2·(-3) + 6 = 0.

What do coefficient a and constant term b mean?

a multiplies x, b stands alone. In ax + b = 0 you want x, not y. a = 0 leaves a blank field.

Does 5x + 15 = 0 give a different x from 2x + 6 = 0?

No. Both give x = -3. That is the same line after cancelling a constant.

What if a = 0?

You do not divide by zero. The result is a blank result. If b is not zero, there is no solution.

What x solves 4x + 2 = 0?

x = -0.5. -2 / 4 = -0.5. A comma and a dot in the field are the same decimal.

Does the calculator solve a system of two equations?

No. One equation, one x. Two lines sit outside this page.

Where is y = ax + b?

On the linear-function card you type x and get y. Here it is the other way: you know a and b, and you want x on the axis.

Can the result be positive?

On this form a and b start at zero and go up, so x = -b/a is zero or negative. A positive x would need a negative b.

Why move b to the other side?

ax = -b, then you divide by a. The minus on b stays in the numerator of x = -b/a.

How is this different from a discriminant?

A discriminant belongs to x². Here you have slope a and one crossing with the axis. No discriminant.

Knowledge sources

The calculator computes the same formula as the definition below.

Page updated in 2026.