# equations for a program

This is a discussion on equations for a program within the C Programming forums, part of the General Programming Boards category; I know this is a programming site but I need to put two simultaneous equations in to a program so ...

1. ## equations for a program

I know this is a programming site but I need to put two simultaneous equations
in to a program so my problem is really math,
My equations are y - 3x + 3 = 0 and y+2x - 3 = 0.

I need to solve them I know you need to eliminate
one of the variables first so I've tried to eliminate y by subtraction with wrong
results, I can't remember if I need to write the equations again in a different format,
Could someone please solve my equations and remind me of the method involved.

Thanks for all the help (leaner wanting to be a master).

2. I'm not quite sure, what you want however, try isolating the variable that you want to solve for. Is it y or x? Isolate either on one side of the equation.

3. I would be happy to solve any x or y I just need to be
shown the method for solving both please, I tried isolating
both seperately but with wrong results I can do it graphically
to obtain both solutions.

BIG thanks.

4. subtract one equation frmo the other, you already have the in the right form.
Code:
```          y-3x+3=0
- y-2x+3=0
----------------
-5x+6=0 => x = 6/5

now substitute x into either equation and solve for y.

y = 3/5```
There is probably more than one solution.

ps. when you wright the code for this, i would like to see it.

5. Multiply y - 3x +3 = 0 by -1 giving you -y +3x -3 = 0. Move the integer over to the other side giving you -y +3x = 3. Do the same for the other equation giving you y +2x = 3. Add the two equation together (y and -y cancell each other) giving you 5x = 6, therefore x = 6/5 = 1.2

Substitute this x value back into one of the original equations -

y -3(1.2) +3 =0

This gives you y -3.6 + 3 = 0

y -0.6 = 0 , therefore y = 0.6

Ta-da!

Ciaran