Linear Equation Solver

This linear equation solver handles one variable in the form ax + b = 0. Enter the coefficient a and constant b. For 2x - 8 = 0, use a = 2 and b = -8. The solution is x = 4 because substituting four makes the left side equal zero.

Linear Equation Solver inputs

Enter zero or signed finite numbers with magnitude from 0.000000001 to 1000000000. Use a decimal point without grouping commas. No expression parser is included.

Loading calculator. JavaScript is required.

The linear equation solver also distinguishes the two cases that have no single root. When a and b are both zero, every real value of x satisfies the equation. When a is zero but b is not, no value of x can satisfy it. Those results describe the equation, rather than an arithmetic failure.

On this page

How to use the linear equation solver

First rearrange your equation so the right side is zero. Collect all terms containing x into one coefficient, then combine the constants. Enter those two numbers in their labeled fields. Include the sign of each number. A positive constant entered where the equation has a negative constant changes the solution.

For example, start with 3x + 7 = 19. Subtract nineteen from both sides to get 3x - 12 = 0. The inputs are therefore a = 3 and b = -12, not a = 3 and b = 7. The linear equation solver gives x = 4. Substitute four into the original equation as a separate check: twelve plus seven equals nineteen.

Linear Equation Solver: Enter coefficients after rearranging. 3x + 7 = 19. 3x - 12 = 0. a = 3, b = -12. The root is x = 4
Linear Equation Solver: Enter coefficients after rearranging. 3x + 7 = 19; 3x - 12 = 0; a = 3, b = -12; The root is x = 4.

The formula and the zero-coefficient cases

For nonzero a, subtract b from both sides of ax + b = 0 to obtain ax = -b. Divide both sides by a. This gives the root x = -b/a. The negative sign belongs to the complete constant, so a negative b produces a positive numerator before division.

Division by zero is not permitted. The linear equation solver checks a before using the formula. With a = 0, the equation reduces to b = 0. If b is also zero, the statement is true regardless of x. If b is nonzero, the statement is false regardless of x. Neither situation can be represented by one numerical root.

Linear Equation Solver: Solve when the coefficient is nonzero. ax + b = 0. ax = -b. x = -b/a. a = 0 requires a separate check
Linear Equation Solver: Solve when the coefficient is nonzero. ax + b = 0; ax = -b; x = -b/a; a = 0 requires a separate check.

Three worked examples

Example one is 2x - 8 = 0. The coefficient is two and the constant is negative eight. The formula gives x = -(-8)/2 = 4. Substitution produces 2 × 4 - 8 = 0. Both the rearranged equation and its solution retain the sign of the original constant.

Example two is -5x + 15 = 0. Enter a = -5 and b = 15. The root is x = -15/(-5) = 3. Multiplying negative five by three gives negative fifteen, which cancels the positive constant. A negative coefficient does not necessarily mean the root is negative.

Example three is 0.5x + 3 = 0. The root is x = -3/0.5 = -6. Substituting negative six gives negative three plus three, or zero. Decimal coefficients follow the same algebraic rule as whole-number coefficients; check the decimal point when copying the input.

Linear Equation Solver: Three roots checked by substitution. 2x - 8 = 0 → x = 4. -5x + 15 = 0 → x = 3. 0.5x + 3 = 0 → x = -6
Linear Equation Solver: Three roots checked by substitution. 2x - 8 = 0 → x = 4; -5x + 15 = 0 → x = 3; 0.5x + 3 = 0 → x = -6.

Check a solution in the original equation

Substitution is a useful check because it tests the answer against the equation you intended to solve. Calculate ax + b using the returned root. For exact arithmetic it is zero. Ordinary browser arithmetic can leave a very small rounding remainder when a division cannot be represented exactly as a binary number.

Also check the equation before rearrangement. An incorrectly moved constant can still produce a root that perfectly satisfies the incorrectly entered equation. Keep the original statement beside your work, preserve its units if it came from a practical problem, and ask whether the root fits any restrictions such as a nonnegative time or an allowed whole count.

Linear equation solver input and precision limits

The linear equation solver accepts zero or a finite signed number with magnitude from 0.000000001 to 1,000,000,000 in each field. Enter a decimal point without grouping commas. Blank fields, non-finite values and numbers outside that range are rejected. The range is an implementation limit, not a restriction on linear equations in mathematics.

Inputs and division use standard browser floating-point arithmetic. A displayed decimal is an approximation when the exact root is a repeating fraction. Keep the coefficients if you need the exact fractional form -b/a. A small coefficient can create a very large root, so compare the scale of the result with the scale of your original problem.

What this tool does and what it leaves to you

This linear equation solver handles one equation after you supply its two coefficients. It does not parse an expression typed as text, simplify brackets automatically, solve simultaneous equations or determine the meaning of a word problem. Expand brackets before collecting terms: 2(x + 3) = 10 becomes 2x - 4 = 0, so the inputs are two and negative four. If an x-squared term remains after simplification, a quadratic method is needed instead.

Calculation uses the values in the form rather than a saved list of earlier attempts. Keep the original equation, coefficient choices and any assumptions with a result you share. A numerical solution establishes which value satisfies the entered algebraic model. It does not establish whether that model describes a measurement, financial arrangement or other real situation accurately.

Questions about linear equation solver

What form does the linear equation solver accept?

It accepts ax + b = 0 through separate coefficient fields. Rearrange the equation and combine like terms before entering a and b. For 4x + 6 = 18, the rearranged form is 4x - 12 = 0. Entering four and negative twelve gives the root three. The form does not read or simplify a complete text expression.

Why is the root negative b divided by a?

Subtracting b from both sides of ax + b = 0 leaves ax = -b. When a is nonzero, division by a gives x = -b/a. Keep the sign of the entered constant. If b is negative eight, then -b is positive eight. The formula follows from applying the same operation to both sides.

What happens when a is zero?

The equation becomes b = 0, so the constant determines the outcome. With b = 0, every real x satisfies the statement. With any nonzero b, no x satisfies it. Dividing by zero would conceal this distinction, so the tool reports the equation type rather than attempting to produce one numerical root.

Can the answer be a negative number?

Yes. For 2x + 8 = 0, the solution is negative four. The sign follows from the coefficients, not from a rule that roots must be positive. If your original application permits only nonnegative values, compare that restriction with the algebraic answer separately. A valid algebraic root can fall outside a practical domain.

Are decimals and fractions supported?

Decimal coefficients are supported within the input range. Convert a fraction to a decimal before entering it, keeping in mind that some fractions have repeating decimal expansions. For an exact fractional answer, retain the symbolic expression -b/a and simplify it separately. The displayed browser result is numerical and may round the final decimal.

How do I enter an equation with x on both sides?

Move all variable terms to one side and all remaining terms to the same side so the other side is zero. For 5x + 2 = 2x + 11, subtraction gives 3x - 9 = 0. Enter a = 3 and b = -9. Substitute the resulting x = 3 into the original equation.

Does multiplying the equation change its root?

Multiplying every term by the same nonzero number preserves the solution set. For example, 2x - 8 = 0 and 6x - 24 = 0 both give x = 4. Multiplying by zero is different because it removes all information and produces an identity. Preserve the same scaling across every term when checking this property.

Why can substitution leave a tiny remainder?

Many decimal values cannot be represented exactly in binary floating-point arithmetic. Division and later multiplication may therefore leave a small rounding difference even when the algebraic method is correct. Compare the remainder with the scale of the coefficients. A large discrepancy usually calls for checking the input signs and rearrangement, rather than dismissing it as rounding.

What if the answer should be a whole count?

The solver finds the real-valued solution of the entered equation. It does not impose an integer restriction. If x represents people, items or another whole count, check whether the result is an allowed integer and whether the model permits it. Rounding a noninteger root changes the value and usually means the original equation is no longer exactly satisfied.

Can this solve two equations together?

No. Two independent linear equations with two unknowns require a system-solving method. This form contains one coefficient of x and one constant only. Reducing a problem to a single equation beforehand is your responsibility. Do not treat two unrelated roots from separate calculations as a solution to a simultaneous system without checking both original equations.

What information should accompany a shared answer?

Keep the original equation, the rearranged ax + b = 0 form, both entered coefficients and any practical restrictions on x. Include the exact fraction -b/a when a rounded decimal would lose useful detail. This makes the calculation reproducible and lets another person check whether a root satisfies the intended equation rather than only the copied numbers.

Sources and method notes

Method and source notes checked on 26 November 2026. The diagrams are original explanatory drawings. Read the privacy policy for other site services.