Solve n equation with n variables.

$\begingroup$

There are $n$ equations and $n$ variables to solve. All the $n$ equations are of the form, for example...

If $n=3$:

$-x+y+z=a$

$x-y+z=b$

$x+y-z=c$

If $n=4:$

$-x+y+z+p=a$

$x-y+z+p=b$

$x+y-z+p=c$

$x+y+z-p=d$

here $a,b,c,d$ are constants.

How to solve this type of equations and calculate value of variables?

$\endgroup$ 1

4 Answers

$\begingroup$

This problem is the starting point of linear algebra. There are different ways to solve such a system, any of which you can Google: Gaussian elimination and Cramer's rule are the two most common.

A good introduction to Linear Algebra is the book by Gilbert Strang.

$\endgroup$ $\begingroup$

If n=3

$ [A|B] = \begin{bmatrix} -1 & 1 & 1 &|a\\ 1 & -1 & 1 &|b\\ 1 & 1 & -1 &|c\\ \end{bmatrix} $

Reduce it to Echelon form as

$ [A|B] = \begin{bmatrix} -1 & 1 & 1 &|a\\ 0 & 0 & 2 &|a+b\\ 0 & 2 & 0 &|a+c\\ \end{bmatrix} $

So we get

$-x+y+z=a$

$2z=a+b$

$2y=a+c$

and find value of x,y and z from above equations

If n=4

$ [A|B] = \begin{bmatrix} -1 & 1 & 1 & 1 &|a\\ 1 & -1 & 1 & 1 &|b\\ 1 & 1 & -1 & 1 &|c\\ 1 & 1 & 1 & -1 &|d\\ \end{bmatrix} $

Reduce it to Echelon form as

$ [A|B] = \begin{bmatrix} -1 & 1 & 1 & 1 &|a\\ 0 & 0 & 2 & 2 &|a+b\\ 0 & 2 & 0 & 2 &|a+c\\ 0 & 2 & 2 & 0 &|a+d\\ \end{bmatrix} $

So we get

$-x+y+z+p=a$

$2z+2p=a+b$

$2y+2p=a+c$

$2y+2z=a+d$

and find value of x,y,z and p from above equations

Similarly,do with other values of n

$\endgroup$ $\begingroup$

These equations have a simple solution. A first step is to add up all the equations, and get the value of $x+y+z$, or $x+y+z+p$.

$\endgroup$ $\begingroup$

Here, your matrix contains -1 in diagonal, and 1 on other locations.

So, solution is as follows,

For n = 3,

  1. Add all the equations, it will give you, (n-2)(x + y + z) = (a + b + c)

     (x+y+z) = (a+b+c)/(n-2)
  2. Now use value of (x+y+z), solve all variables.

For example,

 -x+y+z = a => (x+y+z) - 2x = a => (a+b+c)/(n-2) - 2x = a => x = ( (a+b+c)/(n-2) - a )/2

Similarly you can calculate all variables for n = 4, 5, 6.......

Hope you clear with my explanations. If any doubt ask me.

$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like