#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Need java program to satisfy two functions.

Member Posts: 1
I need to show how to compute both:
X=ab+bc+ad-cc and Y=ab+cc+cd by using only a total of 3 multiplications for both equations. Inputs must be a,b,c and d and output both x and y.

Thanks

• Member Posts: 6,349
: I need to show how to compute both:
: X=ab+bc+ad-cc and Y=ab+cc+cd by using only a total of 3
: multiplications for both equations. Inputs must be a,b,c and d and
: output both x and y.
:
: Thanks
:
What you need to do is to rewrite the functions. I managed to rewrite them to 4 multiplications:
[code]
X = a*(b+d)+c*(b-c)
Y = a*b + c*(c+d)
[/code]
Eliminating the last one eludes me.
• Member Posts: 1
: I need to show how to compute both:
: X=ab+bc+ad-cc and Y=ab+cc+cd by using only a total of 3
: multiplications for both equations. Inputs must be a,b,c and d and
: output both x and y.
:
: Thanks
:
Hi !
I don't know if you need it yet but there is a solution:
X = (a + c)*(b + d) - c*(c + d)
Y = c*(c + d) + a*b

By the way the similar idia was used in Shtrassen algoritm of multiply matrices : for putting down the time of running from n^ 3 to n ^ log 7

Regards
Alexey