Two Linear Equations CalculatorFree online math calculator — instant results, no sign-up

Solve two independent linear equations in two unknowns.

Inputs

x
2
y1

Sign in to save results and favorites.

About the Two Linear Equations Calculator

The Two Linear Equations Calculator solves a pair of independent linear equations in the unknowns x and y using six coefficients and constants. Enter each equation in the form ax + by = c to find the values that satisfy both equations simultaneously. With the default inputs, it solves 2x + y = 5 and x − y = 1, giving x = 2 and y = 1.

First x coefficient
The multiplier of x in the first equation, default 2, is unitless for a purely algebraic problem.
First y coefficient
The multiplier of y in the first equation, default 1, is unitless for a purely algebraic problem.
First constant
The right-hand-side value of the first equation, default 5, is unitless for a purely algebraic problem.
Second x coefficient
The multiplier of x in the second equation, default 1, is unitless for a purely algebraic problem.
Second y coefficient
The multiplier of y in the second equation, default −1, is unitless for a purely algebraic problem.
Second constant
The right-hand-side value of the second equation, default 1, is unitless for a purely algebraic problem.

Formula and method

For a₁x + b₁y = c₁ and a₂x + b₂y = c₂, define D = a₁b₂ − a₂b₁. If D ≠ 0, x = (c₁b₂ − c₂b₁)/D and y = (a₁c₂ − a₂c₁)/D. With the defaults: D = 2(−1) − 1(1) = −3; x = [5(−1) − 1(1)]/(−3) = 2; y = [2(1) − 1(5)]/(−3) = 1.
  • xThe first unknown, whose default-example solution is 2.
  • yThe second unknown, whose default-example solution is 1.
  • a₁The first x coefficient, default 2.
  • b₁The first y coefficient, default 1.
  • c₁The first constant, default 5.
  • a₂The second x coefficient, default 1.
  • b₂The second y coefficient, default −1.
  • c₂The second constant, default 1.
  • DThe determinant of the coefficient matrix; a nonzero value means the system has exactly one solution.

Use the determinant method, also called Cramer's rule: calculate D from the four coefficients, then divide each unknown's numerator by D. For the default equations, D = −3, so a unique solution exists and the formulas give x = 2 and y = 1. Verify by substitution: 2(2) + 1 = 5 and 2 − 1 = 1.

Worked example

These are the calculator's starting values and the results it actually produces for them.

Inputs

  • First x coefficient2
  • First y coefficient1
  • First constant5
  • Second x coefficient1
  • Second y coefficient-1
  • Second constant1

Results

  • x2
  • y1

How to use the Two Linear Equations Calculator

  1. 1Arrange both equations with the x and y terms on the left and the constant on the right, keeping signs when moving terms.
  2. 2Enter the first equation's values: First x coefficient = 2, First y coefficient = 1, and First constant = 5.
  3. 3Enter the second equation's values: Second x coefficient = 1, Second y coefficient = −1, and Second constant = 1.
  4. 4Run the calculation and read the solution rows: x = 2 and y = 1.
  5. 5Substitute both values into both original equations to confirm that each equality holds.

Reading your result

The x output row gives the value of the first unknown, and the y output row gives the value of the second unknown. Read them together as the ordered pair (x, y), not as separate alternative answers. For the defaults, (2, 1) satisfies both equations and is the intersection point of their two lines.

Limitations

The tool is intended for two linear equations in two unknowns with a nonzero coefficient determinant. If D = 0, there is no unique solution: the system has either no solution or infinitely many solutions, and the division formulas cannot be used. Terms such as x², xy, or 1/y are outside its scope. Rounded decimal inputs or a determinant very close to zero can make numerical results sensitive to small input changes. No physical units are assigned automatically; in applied problems, coefficients and constants must make the terms within each equation dimensionally compatible.

Common questions

How do I enter x − y = 1 as the second equation?+

Enter 1 for Second x coefficient, −1 for Second y coefficient, and 1 for Second constant; an unwritten coefficient on x is 1.

Why do the default equations give x = 2 and y = 1?+

Adding 2x + y = 5 and x − y = 1 eliminates y and gives 3x = 6, so x = 2. Substituting into x − y = 1 gives y = 1.

What does a zero determinant mean for these two equations?+

It means the coefficient rows are not independent, so there is no unique pair (x, y). Consistent equations have infinitely many solutions; inconsistent equations have none.

Can an x or y coefficient be zero?+

Yes. Enter 0 when that variable is absent from an equation. A unique solution is still possible as long as the full system has D ≠ 0.

Does the calculator save my information?+

Calculations run in your browser. While signed in, inputs and results are automatically recorded in account history; saving a result creates a separate saved record.

Further reading

You might also like

Results are estimates for informational purposes and are not financial, medical or legal advice.