Giving an integer and return the maximum product of the numbers which sums up to the given number.
Answers
Answered by
4
Let the integer be X.
Suppose ,X = A + B
And Let P be the product.
P = A B
P = A ( X - A)
P= A X - A²
Differentiating both sides with respect to A
For Maxima or minima
=0
→ X - 2 A =0
→ - 2 A = -X
cancelling negative sign from both sides
→2 A= X
→ A = X/2
As , X = A + B
→ X= X/2 + B
→ X - X/2 = B
→B = X/2
= - 2,
Which is negative.As double derivative is negative So P will attain it's maximum value at when A= X/2 and B=X/2, where X is any integer.
For example, suppose an integer be 10, it will attain it's maximum product when we divide it into two equal parts i.e (10/2, 10/2) which is (5,5).
Similar questions