# Lesson Solution of the linear system of two equations with two unknowns using determinant

Algebra ->  Algebra  -> Coordinate Systems and Linear Equations  -> Lessons -> Lesson Solution of the linear system of two equations with two unknowns using determinant      Log On

 Ad: You enter your algebra equation or inequality - Algebrator solves it step-by-step while providing clear explanations. Free on-line demo . Ad: Algebra Solved!™: algebra software solves algebra homework problems with step-by-step help! Ad: Algebrator™ solves your algebra problems and provides step-by-step explanations!

 Linear Solvers Practice Answers archive Word Problems Lessons In depth

### Source code of 'Solution of the linear system of two equations with two unknowns using determinant'

This Lesson (Solution of the linear system of two equations with two unknowns using determinant) was created by by ikleyn(4)  : View Source, Show



Solution of the linear system of two equations with two unknowns using determinant

Let us consider the system of two linear equations with two unknowns. The most general form of such a system is as follows {{{a[11]*x + a[12]*y = b[1]}}},                               (1) {{{a[21]*x + a[22]*y = b[2]}}},                               (2) where {{{a[11]}}}, {{{a[12]}}}, {{{a[21]}}}, {{{a[22]}}} are coefficients; {{{b[1]}}}, {{{b[2]}}} are right side constants; {{{x}}} and {{{y}}} are unknowns. Constants {{{a[11]}}}, {{{a[21]}}}, {{{a[12]}}}, {{{a[22]}}}, {{{b[1]}}} and {{{b[2]}}} are given, the unknown values {{{x}}} and {{{y}}} have to be found to satisfy equations (1) and (2). There are few different methods to solve the linear system of equations (1), (2). Substitution method is described in the lesson Solution of the linear system of two equations with two unknowns by the substitution method in this module. Elimination method is described in the lesson Solution of the linear system of two equations with two unknowns by the Elimination method. In this lesson we describe the determinant method for the solution of the linear equation system (1), (2).

Calculation formulas

Coefficients of the linear equation system (1), (2) form the matrix {{{(matrix(2,2, a[11], a[12], a[21], a[22]))}}} (2x2 matrix with 2 rows and 2 columns), while the right side coefficients {{{b[1]}}}, {{{b[2]}}} form the vector {{{(matrix(2,1, b[1], b[2]))}}} (which you can consider as the matrix with 2 rows and 1 column). The determinant of the 2x2 matrix {{{(matrix(2,2, a[11], a[12], a[21], a[22]))}}} is the value {{{d = det (matrix(2,2, a[11], a[12], a[21], a[22])) = a[11]*a[22]-a[21]*a[12]}}}.      (3) If the determinant {{{d}}} of the matrix {{{(matrix(2,2, a[11], a[12], a[21], a[22]))}}} is not equal to zero, then the solution of the linear equation system (1), (2) does exist, is unique and is expressed by the formulas {{{x = (b[1]*a[22]-b[2]*a[12])/(a[11]*a[22]-a[21]*a[12])}}},                           (4) {{{y = (a[11]*b[2]-a[21]*b[1])/(a[11]*a[22]-a[21]*a[12])}}}.                           (5) Note that the numerator of formulas (4), (5) is the determinant of the matrix obtained from the basic matrix replacing the first column by the right side vector for {{{x}}}, and replacing the second column by the right side vector for {{{y}}}. So, you can rewrite formulas (4) and (5) in the form {{{x = det(matrix(2,2,b[1],a[12],b[2],a[22]))/det(matrix(2,2,a[11],a[12],a[21],a[22]))}}},                                 (4b) {{{y = det(matrix(2,2,a[11],b[1],a[21],b[2]))/det(matrix(2,2,a[11],a[12],a[21],a[22]))}}},                                 (5b)

Example

Solve the system of the two equations {{{system (2x + y = 5, -4x + 6y = -2 )}}} First calculate the determinant of the matrix {{{(matrix(2,2,2,1,-4,6))}}}: {{{det = 2*6-(-4)*1 = 12+4 = 16}}}. Since the determinant is not equal to zero, then according to the theory, the solution does exist, is unique and is calculated by formulas {{{x = (5*6-(-2)*1)/det = (30+2)/16 = 32/16 = 2}}}, {{{y = (2*(-2)-(-4)*5)/det = (-4-(-20))/16 = 16/16 = 1}}}. Let us check the calculated solution. Simply substitute the found values of {{{x=2}}} and {{{y=1}}} to the original system of equations. You will get {{{2*2+1 = 5}}}                   for the left side of the first equation, which coincides with its right side; {{{-4*2+6*1 = -8+6 = -2}}} for the left side of the second equation, which coincides with its right side. The check is done, the solution is correct.

Checking validity of the general solution formula

We can check the validity of the general formulas (4) and (5). To do this, simply substitute the formulas (4) and (5) to the equation (1) first. For simplicity, let us do it for numerators only. We have {{{a[11]*(b[1]*a[22]-b[2]*a[12]) + a[12]*(a[11]*b[2]-a[21]*b[1])}}} = {{{a[11]*a[22]*b[1] - red(a[11]*a[12]*b[2]) + red(a[12]*a[11]*b[2]) - a[12]*a[21]*b[1]}}}. After canceling the terms shown by red this is equal to {{{(a[11]*a[22] - a[12]*a[21])*b[1]}}}. Canceling the numerator and denominator by the determinant, you will get exactly the right side {{{b[1]}}}. Similar proof is for the second equation. You can do it yourself.

How to derive the general solution formulas

If you want to derive the general solution formulas (4) and (5), simply apply the method "multiply and add" to solve equations (1) and (2). Multiply equation (1) by {{{a[22]}}}, equation (2) by {{{a[12]}}} and then add them to eliminate {{{y}}}. You will get {{{a[11]*a[22]*x - a[12]*a[21]*x = a[22]*b[1]-a[12]*b[2]}}}. Express {{{x}}} from this equation, and you will get exactly the formula (4) for {{{x}}}. Similar method works for {{{y}}}. Do it yourself please.