Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I am too rusty in algebra.
I have as input in a program numbers a and b.
I am trying to find them using the bellow relation:

a + b = X;
a * b = Y;

and X and Y are known numbers in my program.
I can't remember how to derive a or b.
I get something like a^2 - aX + Y = 0 but cant't remember how to make it so that it is something like a = ....; an b=....; in my program.

Any help please?

share|improve this question
1  
From there, you could use the quadratic equation. –  The Chaz 2.0 Apr 23 '12 at 14:43
add comment

1 Answer

$$a = \dfrac{X +\sqrt{X^2 - 4Y}}{2}; b = \dfrac{X -\sqrt{X^2 - 4Y}}{2}$$

share|improve this answer
    
Thanks a lot? But how did you derive that? In my program I did this as an "optimization" trick (could do it in another way) but when I couldn't remember how to figure the solution, I was really annoyed by myself –  Jim Apr 23 '12 at 14:49
    
This comes from the quadratic formula. You correctly recalled $$a^2 - Xa + Y = 0$$ and then I used the quadratic formula (and the fact that $a + b = X$) –  The Chaz 2.0 Apr 23 '12 at 14:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.