Algebra

System of Equations Calculator

Solve two linear equations for x and y, or choose three variables to include z. See exact answers, decimal values, and whether the equations have one, many, or no solutions.

Enter linear equations

Two variables is the default. Choose three variables only when you have three equations in x, y, and z.

Write both equations in the form shown below. Enter the six numbers, including any negative signs. Use 0 for a missing term.

Equation 1

a × x + b × y = c

Equation 2

d × x + e × y = f

Signed numbers, including zero. Up to 15 integer digits and 10 decimal places. Grouped commas such as 1,000 are accepted.

Solution

Enter all six coefficients, then select Calculate.

Your inputs are processed in your browser and are not sent to a server.

Find two ticket prices from two purchases

1. Define the unknowns

Adult and child tickets

In this fictional example, two adult tickets and three child tickets cost $39. Three adult tickets and two child tickets cost $46. Assume the same ticket prices for both purchases, with no extra fees or discounts.

Let x be the price of one adult ticket in dollars and y the price of one child ticket in dollars. The ticket counts become the coefficients; each purchase total goes on the right.

2x + 3y = 39
3x + 2y = 46

2. Enter the coefficients

Use the default two-variable mode

Keep Two variables (x, y). In Equation 1, enter a = 2, b = 3, c = 39. In Equation 2, enter d = 3, e = 2, f = 46. Select Calculate.

Equation 1: 2, 3, 39
Equation 2: 3, 2, 46

Type only the numbers into the six fields. Keep adult tickets in the x column and child tickets in the y column for both rows. Try an example loads the separate x = 2, y = 1 example below.

3. Interpret and check

$12 per adult, $5 per child

x = 12; y = 5
2 × 12 + 3 × 5 = 39
3 × 12 + 2 × 5 = 46

The answers are prices per ticket, not ticket counts or purchase totals. Substituting them reproduces both totals. In the calculation steps, a left-side-minus-right-side value of 0 for each equation confirms that check.

Infinitely many solutions would mean the totals do not determine both prices uniquely. No solution would mean they conflict under the stated assumptions. A negative price could satisfy the equations but would not fit this ticket example; check the entered counts, totals, and assumptions.

How the calculation works

Unique solution

2x + y = 5 and x − y = 1

x = 2; y = 1

Add the equations to get 3x = 6. Then x = 2, and the second equation gives y = 1. Check: 2 × 2 + 1 = 5, and 2 − 1 = 1.

Exact fractions

3x = 1 and 2y = −1

x = 1/3; y = −1/2

Enter 3, 0, 1 for the first equation and 0, 2, −1 for the second. At six decimal places, x is approximately 0.333333 while y is exactly −0.5.

Dependent equations

x + 2y = 6 and 2x + 4y = 12

y = 3 − x/2

The second equation doubles the first and adds no restriction. Any real x is allowed when y follows this relation: (0, 3) and (2, 2) are two of infinitely many solutions.

Inconsistent equations

x + y = 2 and x + y = 3

No solution

The same sum cannot equal both 2 and 3. Subtracting the equations produces 0 = 1, a contradiction.

Optional three-variable examples

One solution: x + y + z = 6, 2x − y + z = 3, and x + 2y − z = 2 give x = 1, y = 2, z = 3. Check: 1 + 2 + 3 = 6; 2 − 2 + 3 = 3; 1 + 4 − 3 = 2. Select Three variables and Try an example to load this system.

Infinitely many solutions: x + y + z = 6, 2x + 2y + 2z = 12, and x − y = 0 give x = 3 − z/2 and y = 3 − z/2, with any real z. For example, z = 2 gives (2, 2, 2), while z = 0 gives (3, 3, 0).

No solution: x + y + z = 6, 2x + 2y + 2z = 13, and x − y = 0 are inconsistent: subtracting twice the first equation from the second gives 0 = 1.

Row reduction for three variables

The optional mode uses exact Gauss–Jordan elimination on the three coefficient rows and their right-hand values. It swaps rows when needed, divides by nonzero pivots, and eliminates the other entries in each pivot column. The steps show these operations.

Three independent coefficient rows give a unique triple. A contradictory zero row gives no solution. Otherwise, the result expresses pivot variables in terms of the free variables, which can vary independently. Coefficient rank counts the independent variable conditions; augmented rank also includes the right-hand column. Unequal ranks mean the system is inconsistent.

Further reading: OpenStax, Solving Systems with Gaussian Elimination.

Determinants and Cramer's rule

For a × x + b × y = c and d × x + e × y = f, calculate D = a × e − b × d. If D is nonzero, x = (c × e − b × f) ÷ D and y = (a × f − c × d) ÷ D. The calculator verifies both equations using those exact answers.

When D is zero, division by D cannot be used. The calculator checks for contradictory zero rows and compares the remaining coefficient and constant relationships to distinguish no solution from infinitely many solutions.

Further reading: OpenStax, Systems of Linear Equations: Two Variables and Solving Systems with Cramer's Rule.

Common questions

What kinds of equations can I solve?

The default handles two linear equations in x and y. Select Three variables to solve three linear equations in x, y, and z on this same page. Terms such as x², xy, sin(x), and 1/x are nonlinear and are outside its scope, as are systems with four or more variables. Enter coefficients in separate fields, not whole expressions.

Do I need to use the three-variable option?

No. Two variables remains the default and uses the same calculation method. Switching modes preserves the numbers you entered but clears the previous result. Only the selected mode's fields are checked. Reset clears both sets of inputs and returns to Two variables with six decimal places.

How do I read a three-variable solution family?

A free variable can be any real number. Choose its value, then calculate the remaining variables from the displayed relations. When two or three variables are free, choose them independently. A zero equation such as 0x + 0y + 0z = 0 adds no restriction; a row such as 0x + 0y + 0z = 5 makes the entire system inconsistent.

What do I enter for a missing variable?

Use zero. The equation 4y = 8 becomes 0 × x + 4 × y = 8. A bare x or y has coefficient 1; a term −x or −y has coefficient −1. Blank fields are not treated as zero.

What happens if all variable coefficients are zero?

An equation 0x + 0y = 0 is true for any pair. An equation 0x + 0y = 5 is impossible. If both equations are identities, x and y may vary independently over all real numbers. If either equation is impossible, the system has no solution.

Why show both fractions and decimals?

Finite decimal inputs are converted to exact fractions. Products, determinants, classification, and substitution checks use integer arithmetic. The decimal display defaults to six places, with options for 0, 2, 4, 6, or 10; it omits unnecessary trailing zeros. Halfway values round away from zero. The ≈ marker means a displayed decimal differs from the exact answer, including a nonzero value rounded to zero.

Does a very small determinant count as zero?

No. A nonzero determinant gives a unique solution even when it is very small. Inputs are treated as exact entered values. If they represent rounded measurements, their uncertainty can strongly affect the solution of nearly dependent equations; this tool does not estimate measurement uncertainty.

Can I enter fractions, scientific notation, or commas?

Enter signed whole numbers or decimals, with up to 15 digits before the decimal point and 10 after it. Correctly grouped thousands commas are accepted, as in −1,234.5. Use a decimal point and a leading zero, such as 0.5. Fraction syntax such as 1/3, scientific notation, and expressions are not accepted in coefficient fields. A typed 0.3333333333 is that exact decimal, not the exact fraction 1/3.