Sum and Product Problem with the Casio fx-4000P
The Sum and Product Problem
For the numbers a and b with the sum s, and product p:
a + b = s
a * b = p
Let's find a solution for a and b:
a + b = s
b = s - a
a * b = p
a * (s - a) = p
a * s - a^2 = p
0 = a^2 - a * s + p
a = (s ± √(s^2 - 4 * p))/2
Then:
b = s - a
= s - (s ± √(s^2 - 4 * p))/2
= (2*s)/2 - (s ± √(s^2 - 4 * p))/2
= (2*s -s ±√(s^2 - 4 * p))/2
= (s ± √(s^2 - 4 * p))/2
Note that addition and multiplication are communitive.
Without loss of generality, let:
a = (s + √(s^2 - 4 * p))/2
b = (s - √(s^2 - 4 * p))/2
Verification:
a + b
= (s + √(s^2 - 4*p))/2 + (s - √(s^2 - 4*p))/2
= (s + √(s^2 - 4*p) + s - √(s^2 - 4*p))/2
= (2 * s)/2
= s
a * b
= (s + √(s^2 - 4 * p))/2 * (s + √(s^2 - 4 * p))/2
= (s/2)^2 - (√(s^2 - 4 * p)/2)^2
= s^2/4 - (s^2 - 4 *p)/4
= (s^2 - s^2 + 4 * p)/4
= (4 * p)/4
= p
Casio fx-4000P Program: Sum and Product Problem
This program can be adopted to many programming and graphing calculators.
Program:
"A+B=":?→S:
"AB=":?→P:
(S+√(S²-4P))÷2→A◢
S-A→B
Examples
S: Sum
P: Product
Example 1:
S = 12, P =32;
Results: 8, 4
Example 2:
S = 8, P = 15;
Results: 5, 3
Enjoy! Until next time,
Eddie
All original content copyright, © 2011-2023. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.