Enter the coefficients and the right-hand sides of equations (1) and (2). The system below is linked to the input fields, so you can also edit the numbers directly in it.
Table of Contents
-
What you can do on this page
-
What is this calculation used for?
-
How to Use
-
Formulas and graphs
-
Symbols and terms
-
Good to know before you start
-
How to calculate it in Excel
-
How to calculate it in Google Sheets
-
How to calculate it in Python
-
How to write it in LaTeX and other math languages (copy and paste)
-
How to have ChatGPT do the calculation
-
DataChef Features
-
Related Features
-
NumberChef Calculators List
What you can do on this page
- Solve a system of two linear equations, \(ax + by = c,\ dx + ey = f\), on the spot just by entering the coefficients and the right-hand sides. The calculator shows the system as you would write it by hand, and you can edit the numbers right in it
- Choose the elimination method (match the coefficients, then add or subtract the equations) or the substitution method (rewrite one equation as \(y = \) and substitute). The steps follow the same flow as a school algebra textbook
- Coefficients can be decimals, negative numbers or fractions such as 3/4 (for fractions and decimals, the steps start by multiplying both sides to make the coefficients whole numbers)
- Besides a single solution, it detects no solution (parallel lines) and infinitely many solutions (the same line), and explains why. Answers are shown as fractions in lowest terms (exact values), with decimals added when they are fractions. You also get a graph of the two lines (the intersection is the solution) and a check that substitutes the solution into both equations
- A plain-language explanation of the formulas and copy-and-paste formulas for Excel, Google Sheets and Python are all on this page
What is this calculation used for?
Suppose you have two receipts that show only totals: "1 coffee and 1 bagel for $5.50" and "2 coffees and 1 bagel for $9.00". Let a coffee be \(x\) dollars and a bagel \(y\) dollars. The system \(x + y = 5.5\), \(2x + y = 9\) gives a coffee at $3.50 and a bagel at $2.00.
"The single prices are not shown, but the totals of combinations are" is the most classic use of a system of equations, and it also comes up when breaking down bills and quotes in bookkeeping.
Plan A costs $15 a month plus $5 per GB, and Plan B costs $30 a month plus $2 per GB. With the monthly bill \(y\) dollars and the data \(x\) GB, they are \(y = 5x + 15\) and \(y = 2x + 30\). Solving the system gives \(x = 5\) GB, where both bills are the same, $40.
So "if you use more than 5 GB, Plan B is cheaper". Finding the intersection of two lines, the crossover point, works the same way for comparing electricity plans or subscriptions (assuming the price grows in proportion to how much you use).
It is 1.5 miles from home to the station. You walk at 3 mph, then run at 6 mph, and arrive in 20 minutes (\(\dfrac{1}{3}\) hour). With \(x\) miles walked and \(y\) miles run, the distance equation is \(x + y = 1.5\) and the time equation is \(\dfrac{x}{3} + \dfrac{y}{6} = \dfrac{1}{3}\). Solving gives 0.5 mile walked and 1 mile run.
Whenever you have a total and a second amount decided by how the total is split (time, cost, and so on), you get a system of equations. This pattern is useful far beyond speed problems.
To make 300 mL of an 8% solution by mixing a 5% solution and a 10% solution, let \(x\) mL be the 5% solution and \(y\) mL the 10% solution. The total amount gives \(x + y = 300\), and the amount of the dissolved substance gives \(0.05x + 0.1y = 24\) (8% of 300 mL is 24 mL). Solving gives 120 mL of the 5% solution and 180 mL of the 10% solution.
Diluting cleaning concentrate, mixing fertilizer, making metal alloys: this calculation is used wherever two ingredients are mixed to reach a target strength.
A product sells for $8, its materials cost $5 per unit, and fixed costs such as rent are $900 a month. With \(x\) units sold per month and \(y\) dollars, the revenue equation is \(y = 8x\) and the cost equation is \(y = 5x + 900\). Their intersection is \(x = 300\) units and \(y = 2{,}400\) dollars, so 300 units a month is the line between profit and loss (the break-even point).
It is one of the first numbers to check in a business plan or when setting a price, and it is a system of equations at heart (assuming the price and the unit cost do not change with the quantity).
Formulas and graphs
Symbols and terms
Symbols
| \(x,\ y\) | ex, why | The letters for the two numbers you want to find (the unknowns). By custom, letters near the end of the alphabet, \(x,\ y,\ z\), are used for numbers we do not know yet. |
| \(a,\ b,\ c,\ d,\ e,\ f\) | a, b, c, d, e, f | Letters that stand for the coefficients and the right-hand constants (the known numbers). By custom, letters near the start of the alphabet are used for fixed numbers. On this page, (1) is \(ax + by = c\) and (2) is \(dx + ey = f\). |
| (1), (2) | equation one, equation two | Numbers given to the equations. They are used to write briefly which operation was done to which equation, as in "(1) × 2" or "(1) + (2)". Textbooks and worked solutions use them too. |
| \(\{\) | brace | The large brace on the left of a system of equations. It means "these two equations must be true at the same time", showing that they belong together as a set. |
| \(ae - bd\) | a e minus b d | The value in the denominator of the one-step formula, found by cross-multiplying the coefficients and subtracting. Whether it is 0 decides whether there is exactly one solution. In the language of matrices, it is the determinant of the matrix of coefficients. |
| \((x,\ y)\) | the pair x, y | A way of writing two values as a set. The solution of a system is a pair of \(x\) and \(y\), so it is written as an ordered pair such as \((2,\ 3)\), the same way as the coordinates of a point on a graph. |
Terms
| system of equations | Two or more equations taken as a set, where you look for the values of the variables that make all of them true at the same time. Taught in Grade 8 and Algebra 1. |
| linear equation in two variables | An equation with two variables in which every term is first degree (no squares and no variables multiplied together). \(x + y = 5\) is a linear equation in two variables. Its graph is a straight line. |
| solution | The values of the variables that make the equations true. For a system, the solution is a pair of values of \(x\) and \(y\), which on a graph is the point of intersection of the two lines. |
| elimination method | A way of solving by matching the coefficients of the two equations and then adding or subtracting them (left side to left side, right side to right side) to eliminate one variable. It is also called the addition method. |
| adding the equations | Adding the left sides together and the right sides together, and joining the two sums with "=" to make a new equation. Subtracting the equations works the same way. |
| substitution method | A way of solving by rewriting one equation in the form "\(y = \) (an expression in \(x\))" and substituting it for \(y\) in the other equation to eliminate one variable. |
| substitute | To put a value or an expression in place of a letter. Substituting \(y = 5 - x\) into \(2x - y = 1\) gives \(2x - (5 - x) = 1\). |
| eliminate | To remove one of the two variables from the equations, leaving an equation with only one variable. The elimination and substitution methods are both ways to do this. |
| moving a term | Moving a term of an equation to the other side and changing its sign. Moving the \(3\) in \(x + 3 = 7\) gives \(x = 7 - 3\). It is a shortcut for "subtract the same number from both sides". |
| coefficient | The number in front of a letter. In \(2x\), the coefficient is 2. When no number is written, as in \(x\), the coefficient is 1, and the coefficient of \(-y\) is \(-1\). |
| properties of equality | An equation stays true when you add, subtract or multiply both sides by the same number, or divide both sides by the same nonzero number. It is like a balance scale that stays level when the same weight is put on both pans. Every step of elimination and substitution is based on these properties. |
| least common multiple (LCM) | The smallest number that is a multiple of both numbers. In the elimination method it is the target when matching coefficients (for coefficients 2 and 3, match them at 6). |
| parallel | Two lines that never meet, however far they go. In a system of equations, if the two graphs are parallel there is no intersection, so there is "no solution". |
| infinitely many solutions | When there is not one single solution but infinitely many. This happens when the two equations describe the same line, so every point on the line is a solution. Such a system is called dependent. |
| point of intersection | The point where two graphs cross. The solution of a system of equations is the coordinates of the point where the graphs of the two equations (two lines) cross. |
| check | Substituting the solution into both original equations to make sure the left and right sides really are equal. A system can be checked just by substituting, so making it a habit helps you catch your own mistakes. |
| Cramer's rule | A formula that calculates the solution directly from the coefficients: \(x = \dfrac{ce - bf}{ae - bd},\ y = \dfrac{af - cd}{ae - bd}\). It is named after the Swiss mathematician Gabriel Cramer. It is usually taught with matrices in high school or linear algebra in college, but for two variables you can check it with basic algebra. |
Good to know before you start
Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
If you get stuck, going back to review these topics is the fastest way forward.
| Expressions with variables (Grades 6–7) |
|
| Arithmetic with negative numbers (Grade 7) |
|
| Properties of equality and linear equations (Grades 7–8) |
|
| Coordinates and graphs (Grades 6–8) |
|
| Working with fractions (Grades 5–7) |
|
How to calculate it in Excel
| (1) x coefficient a | 1 |
| (1) y coefficient b | 1 |
| (1) right side c | 5 |
| (2) x coefficient d | 2 |
| (2) y coefficient e | -1 |
| (2) right side f | 1 |
| Denominator ae−bd | =B1*B5-B2*B4 |
| Solution x ((ce−bf)÷(ae−bd)) | =(B3*B5-B2*B6)/B7 |
| Solution y ((af−cd)÷(ae−bd)) | =(B1*B6-B3*B4)/B7 |
| (1) x coefficient a | 1 |
| (1) y coefficient b | 1 |
| (1) right side c | 3 |
| (2) x coefficient d | 2 |
| (2) y coefficient e | 2 |
| (2) right side f | 6 |
| Denominator ae−bd | =B1*B5-B2*B4 |
| Numerator ce−bf | =B3*B5-B2*B6 |
| Numerator af−cd | =B1*B6-B3*B4 |
| Result | =IF(B7<>0,"One solution",IF(AND(B8=0,B9=0),"Infinitely many solutions","No solution (parallel)")) |
| (1) x coefficient a | 1 |
| (1) y coefficient b | 1 |
| (1) right side c | 5 |
| (2) x coefficient d | 2 |
| (2) y coefficient e | -1 |
| (2) right side f | 1 |
| Solution x | 2 |
| Solution y | 3 |
| Left side of (1) ax+by (correct if equal to c) | =B1*B7+B2*B8 |
| Left side of (2) dx+ey (correct if equal to f) | =B4*B7+B5*B8 |
The first table solves x + y = 5, 2x − y = 1. The denominator ae−bd is −3, and the solution is x = 2, y = 3. If the denominator is 0, the division gives an error (#DIV/0!), which is the sign that there is no single solution.
The second table is for x + y = 3, 2x + 2y = 6, and the result is "Infinitely many solutions". Change the right side f of (2) to 10 and it becomes "No solution (parallel)".
The third table checks the solution by substituting it into both equations. The left side of (1) is 5 and the left side of (2) is 1, matching their right sides.
How to calculate it in Google Sheets
| (1) x coefficient a | 1 |
| (1) y coefficient b | 1 |
| (1) right side c | 5 |
| (2) x coefficient d | 2 |
| (2) y coefficient e | -1 |
| (2) right side f | 1 |
| Denominator ae−bd | =B1*B5-B2*B4 |
| Solution x ((ce−bf)÷(ae−bd)) | =(B3*B5-B2*B6)/B7 |
| Solution y ((af−cd)÷(ae−bd)) | =(B1*B6-B3*B4)/B7 |
| (1) x coefficient a | 1 |
| (1) y coefficient b | 1 |
| (1) right side c | 3 |
| (2) x coefficient d | 2 |
| (2) y coefficient e | 2 |
| (2) right side f | 6 |
| Denominator ae−bd | =B1*B5-B2*B4 |
| Numerator ce−bf | =B3*B5-B2*B6 |
| Numerator af−cd | =B1*B6-B3*B4 |
| Result | =IF(B7<>0,"One solution",IF(AND(B8=0,B9=0),"Infinitely many solutions","No solution (parallel)")) |
| (1) x coefficient a | 1 |
| (1) y coefficient b | 1 |
| (1) right side c | 5 |
| (2) x coefficient d | 2 |
| (2) y coefficient e | -1 |
| (2) right side f | 1 |
| Solution x | 2 |
| Solution y | 3 |
| Left side of (1) ax+by (correct if equal to c) | =B1*B7+B2*B8 |
| Left side of (2) dx+ey (correct if equal to f) | =B4*B7+B5*B8 |
How to calculate it in Python
from fractions import Fraction
# (1): a1*x + b1*y = c1
# (2): a2*x + b2*y = c2 (a fraction such as 3/4 can be written Fraction(3, 4))
a1, b1, c1 = Fraction(1), Fraction(1), Fraction(5)
a2, b2, c2 = Fraction(2), Fraction(-1), Fraction(1)
denominator = a1 * b2 - a2 * b1 # denominator of the formula, ae − bd
if denominator != 0:
x = (c1 * b2 - c2 * b1) / denominator
y = (a1 * c2 - a2 * c1) / denominator
print(f"Solution: x = {x}, y = {y}")
print(f"As decimals: x = {float(x)}, y = {float(y)}")
elif c1 * b2 - c2 * b1 == 0 and a1 * c2 - a2 * c1 == 0:
print("Infinitely many solutions (both equations describe the same line)")
else:
print("No solution (the two lines are parallel and never meet)")
How to write it in LaTeX and other math languages (copy and paste)
ax + by = c, dx + ey = f
\begin{cases} ax + by = c \\ dx + ey = f \end{cases}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mo>{</mo>
<mtable columnalign="left">
<mtr><mtd>
<mi>a</mi><mi>x</mi><mo>+</mo><mi>b</mi><mi>y</mi><mo>=</mo><mi>c</mi>
</mtd></mtr>
<mtr><mtd>
<mi>d</mi><mi>x</mi><mo>+</mo><mi>e</mi><mi>y</mi><mo>=</mo><mi>f</mi>
</mtd></mtr>
</mtable>
</mrow>
</math>
{(ax + by = c),(dx + ey = f):}
Solve[{a*x + b*y == c, d*x + e*y == f}, {x, y}]
solve({a*x + b*y = c, d*x + e*y = f}, {x, y});
S = solve(a*x + b*y == c, d*x + e*y == f, [x, y])
ax + by = c, dx + ey = f
(ax + by) − (ax + ey) = c − f
(ax + by) - (ax + ey) = c - f
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mo>(</mo><mi>a</mi><mi>x</mi><mo>+</mo><mi>b</mi><mi>y</mi><mo>)</mo>
<mo>−</mo>
<mo>(</mo><mi>a</mi><mi>x</mi><mo>+</mo><mi>e</mi><mi>y</mi><mo>)</mo>
<mo>=</mo>
<mi>c</mi><mo>−</mo><mi>f</mi>
</mrow>
</math>
(ax + by) - (ax + ey) = c - f
Simplify[(a*x + b*y) - (a*x + e*y) == c - f]
(a*x + b*y) - (a*x + e*y) = c - f;
simplify((a*x + b*y) - (a*x + e*y) == c - f)
(ax + by) − (ax + ey) = c − f
y = px + q, dx + e(px + q) = f
y = px + q,\quad dx + e(px + q) = f
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>y</mi><mo>=</mo><mi>p</mi><mi>x</mi><mo>+</mo><mi>q</mi>
<mo>,</mo>
<mi>d</mi><mi>x</mi><mo>+</mo><mi>e</mi>
<mo>(</mo><mi>p</mi><mi>x</mi><mo>+</mo><mi>q</mi><mo>)</mo>
<mo>=</mo><mi>f</mi>
</mrow>
</math>
y = px + q, dx + e(px + q) = f
Solve[{y == p*x + q, d*x + e*y == f}, {x, y}]
subs(y = p*x + q, d*x + e*y = f);
subs(d*x + e*y == f, y, p*x + q)
y = px + q, dx + e(px + q) = f
x = (ce − bf)/(ae − bd), y = (af − cd)/(ae − bd)
x = \frac{ce - bf}{ae - bd},\quad y = \frac{af - cd}{ae - bd}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>x</mi><mo>=</mo>
<mfrac>
<mrow><mi>c</mi><mi>e</mi><mo>−</mo><mi>b</mi><mi>f</mi></mrow>
<mrow><mi>a</mi><mi>e</mi><mo>−</mo><mi>b</mi><mi>d</mi></mrow>
</mfrac>
<mo>,</mo>
<mi>y</mi><mo>=</mo>
<mfrac>
<mrow><mi>a</mi><mi>f</mi><mo>−</mo><mi>c</mi><mi>d</mi></mrow>
<mrow><mi>a</mi><mi>e</mi><mo>−</mo><mi>b</mi><mi>d</mi></mrow>
</mfrac>
</mrow>
</math>
x = (ce - bf)/(ae - bd), y = (af - cd)/(ae - bd)
{x, y} = {(c*e - b*f)/(a*e - b*d), (a*f - c*d)/(a*e - b*d)}
x := (c*e - b*f)/(a*e - b*d); y := (a*f - c*d)/(a*e - b*d);
x = (c*e - b*f)/(a*e - b*d); y = (a*f - c*d)/(a*e - b*d);
x = (ce − bf)/(ae − bd), y = (af − cd)/(ae − bd)
How to have ChatGPT do the calculation
You are a calculation assistant for math (systems of equations). Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing). Solve the system of equations x + y = 5, 2x − y = 1. Show each of the following: 1. The solution x, y (if they are fractions, give both fractions in lowest terms and decimals) 2. The steps with the elimination method (match the coefficients of one variable, then add or subtract the equations) 3. A check that substitutes the solution into both equations In Python, calculate exactly with the fractions module from the standard library, and show the formulas you used and the numbers from the execution result. If there is no solution or there are infinitely many, also explain why.
How to Use
-
1Enter your numbersType the numbers you want to calculate with into the input fields
-
2CalculatePress the "Calculate" button
-
3Check the resultThe result appears on the spot. The same page also explains the idea behind the calculation and the formula
DataChef Features
No technical knowledge required.
Intuitive and user-friendly operation.
Can be used without registering personal information.
Automatic file deletion by clicking "download".
and rapid file conversion.
No attribution required.
No need to contact us for commercial use permission.
