Solve for x, y
Graph

## Share

x+y=1,3x+y=5
To solve a pair of equations using substitution, first solve one of the equations for one of the variables. Then substitute the result for that variable in the other equation.
x+y=1
Choose one of the equations and solve it for x by isolating x on the left hand side of the equal sign.
x=-y+1
Subtract y from both sides of the equation.
3\left(-y+1\right)+y=5
Substitute -y+1 for x in the other equation, 3x+y=5.
-3y+3+y=5
Multiply 3 times -y+1.
-2y+3=5
-2y=2
Subtract 3 from both sides of the equation.
y=-1
Divide both sides by -2.
x=-\left(-1\right)+1
Substitute -1 for y in x=-y+1. Because the resulting equation contains only one variable, you can solve for x directly.
x=1+1
Multiply -1 times -1.
x=2
x=2,y=-1
The system is now solved.
x+y=1,3x+y=5
Put the equations in standard form and then use matrices to solve the system of equations.
\left(\begin{matrix}1&1\\3&1\end{matrix}\right)\left(\begin{matrix}x\\y\end{matrix}\right)=\left(\begin{matrix}1\\5\end{matrix}\right)
Write the equations in matrix form.
inverse(\left(\begin{matrix}1&1\\3&1\end{matrix}\right))\left(\begin{matrix}1&1\\3&1\end{matrix}\right)\left(\begin{matrix}x\\y\end{matrix}\right)=inverse(\left(\begin{matrix}1&1\\3&1\end{matrix}\right))\left(\begin{matrix}1\\5\end{matrix}\right)
Left multiply the equation by the inverse matrix of \left(\begin{matrix}1&1\\3&1\end{matrix}\right).
\left(\begin{matrix}1&0\\0&1\end{matrix}\right)\left(\begin{matrix}x\\y\end{matrix}\right)=inverse(\left(\begin{matrix}1&1\\3&1\end{matrix}\right))\left(\begin{matrix}1\\5\end{matrix}\right)
The product of a matrix and its inverse is the identity matrix.
\left(\begin{matrix}x\\y\end{matrix}\right)=inverse(\left(\begin{matrix}1&1\\3&1\end{matrix}\right))\left(\begin{matrix}1\\5\end{matrix}\right)
Multiply the matrices on the left hand side of the equal sign.
\left(\begin{matrix}x\\y\end{matrix}\right)=\left(\begin{matrix}\frac{1}{1-3}&-\frac{1}{1-3}\\-\frac{3}{1-3}&\frac{1}{1-3}\end{matrix}\right)\left(\begin{matrix}1\\5\end{matrix}\right)
For the 2\times 2 matrix \left(\begin{matrix}a&b\\c&d\end{matrix}\right), the inverse matrix is \left(\begin{matrix}\frac{d}{ad-bc}&\frac{-b}{ad-bc}\\\frac{-c}{ad-bc}&\frac{a}{ad-bc}\end{matrix}\right), so the matrix equation can be rewritten as a matrix multiplication problem.
\left(\begin{matrix}x\\y\end{matrix}\right)=\left(\begin{matrix}-\frac{1}{2}&\frac{1}{2}\\\frac{3}{2}&-\frac{1}{2}\end{matrix}\right)\left(\begin{matrix}1\\5\end{matrix}\right)
Do the arithmetic.
\left(\begin{matrix}x\\y\end{matrix}\right)=\left(\begin{matrix}-\frac{1}{2}+\frac{1}{2}\times 5\\\frac{3}{2}-\frac{1}{2}\times 5\end{matrix}\right)
Multiply the matrices.
\left(\begin{matrix}x\\y\end{matrix}\right)=\left(\begin{matrix}2\\-1\end{matrix}\right)
Do the arithmetic.
x=2,y=-1
Extract the matrix elements x and y.
x+y=1,3x+y=5
In order to solve by elimination, coefficients of one of the variables must be the same in both equations so that the variable will cancel out when one equation is subtracted from the other.
x-3x+y-y=1-5
Subtract 3x+y=5 from x+y=1 by subtracting like terms on each side of the equal sign.
x-3x=1-5
Add y to -y. Terms y and -y cancel out, leaving an equation with only one variable that can be solved.
-2x=1-5