# Systems of Three Equations with Three Variables

Consider system of three equations with three variables {(f(x,y,z)=0),(g(x,y,z)=0),(h(x,y,z)=0):}.

Solution of such system is any triple of numbers that satisfies all equations in the system.

Example 1. Solve system equations {(x+y+z=2),(2x+3y+z=1),(x^2+(y+2)^2+(z-1)^2=9):}.

Let's apply substitution method. Express from first equation x through y an z, and plug obtained expression into other equations:

{(x=2-y-z),(2(2-y-z)+3y+z=1),((2-y-z)^2+(y+2)^2+(z-1)^2=9):} or {(x=2-y-z),(y-z=-3),(y^2+z^2+yz-3z=0):}.

Last two equations doesn't contain x, so they form system of two equations with two variables: {(y-z=-3),(y^2+z^2+yz-3z=0):} . To solve it, we again apply substitution method. From first equation y=z-3, plugging this expression into second equation gives {(y=z-3),((z-3)^2+z^2+(z-3)z-3z=0):} or {(y=z-3),(z^2-4z+3=0):}.

From second equation z^2-4z+3=0 we obtain that z_1=1,z_2=3.

Now, from equation y=z-3 we obtain that y_1=z_1-3=1-3=-2 and y_2=z_2-3=3-3=0.

Finally, from equation x=2-y-z we obtain that x_1=2-y_1-z_1=2-(-2)-1=3 and x_2=2-y_2-z_2=2-0-3=-1.

So, initial system has two solutions: (3;-2;1) and (-1;0;3).

Example 2. Solve following system of equations: {(-x+4y+z=4),(2x+y-z=7),(3x+2y+2z=1):}.

Let's try to eliminate x from second and third equations.

First we eliminate x in second equation: for this replace second equation with sum of first equation multiplied by 2 and second equation:

{(-x+4y+z=4),(2(-x+4y+z)+(2x+y-z)=2*4+7),(3x+2y+2z=1):} or {(-x+4y+z=4),(9y+z=15),(3x+2y+2z=1):}.

Now eliminate x in third equation: for this replace third equation with sum of first equation multiplied by 3 and third equation:

{(-x+4y+z=4),(9y+z=15),(3(-x+4y+z)+(3x+2y+2z)=3*4+1):} or {(-x+4y+z=4),(9y+z=15),(14y+5z=13):}.

Last step is to eliminate y from third equation: for this replace third equation with sum of second equation multiplied by 14 and third equation multiplied by -9:

{(-x+4y+z=4),(9y+z=5),(14(9y+z)+(-9)(14y+5z)=14*15+(-9)*13):} or {(-x+4y+z=4),(9y+z=5),(-31z=93):}.

Now, we perform so-called "backward substitution":

1. From third equation z=(93)/(-31)=-3;
2. From second equation y=(15-z)/9=(15-(-3))/9=2.
3. From first equation x=4y+z-4=4*2+(-3)-5=1.

Therefore, (1;2;-3) is solution of the initial system.

Method that was described above is called Method of Gauss.