Discussion 13

Chapter 4.3

Problem 3: Find the maximum product of two numbers (not necessarily integers) that have a sum of 100.

In this problem we realize that our two numbers will be \(x\) and \((100-x)\) in order to have a sum of 100, then our product will be \(P=x\times (100-x)\) or \(P=100x-{ x }^{ 2 }\)

To find the two numbers that give us the maximum product we first find the derivative of \(P=100x-{ x }^{ 2 }\)

f <- expression(100*x-x^2)
D(f, "x")
## 100 - 2 * x

According to our calculations the derivative of \(P=100x-{ x }^{ 2 }\) is:

\(P'=100-2x\)

We solve for \(x\) such that \(0=100-2x\) and find:

solve_x <- function(x){
  100-2*x
}
uniroot(solve_x, lower=0.1, upper=100)$root
## [1] 50

We found that \(x=50\) this means that our second number is \(100-x=100-50=50\).

Thus the maximum product of the two numbers that have a sum of 100 is:

50*50
## [1] 2500

2,500