# Calculating maximum of function

I want to determine the value of a constant $a > 0$ which causes the highest possible value of $f(x) = ax(1-x-a)$.

I have tried deriving the function to find a relation between $x$ and $a$ when $f'(x) = 0$, and found $x = \frac{1-a}{2}$.

I then insert it into the original function: $f(a) = \frac{3a - 6a^2 - 5a^3}{8}$

I derived it to $f'(a) = \frac{-15a^2 + 12a - 3}{8}$

I thought deriving the function and equaling it to $0$ would lead to finding a maximum, but I can't find it. I can't go beyond $-15a^2 + 12a = 3$.

Where am I going wrong?

-
One thing that I didn´t understand: $f(a)=\frac {3a-6a^2-5a^3}{8}$ Then,the $f´(a)=\frac {-15x^2+12x-3}{8}$.First is $a$ ,then is $x$? Correct me ,anyone,please,if I´m saying wrong...just did not understand. – HipsterMathematician Jul 20 '12 at 21:17
i think $a$ should be from 2 to infinity – dato datuashvili Jul 20 '12 at 21:25
@MeAndMath Yes, that was a typo. Thanks (and to J.M. who edited). – Quispiam Jul 21 '12 at 8:15
@Quispiam We are here to help! – HipsterMathematician Jul 21 '12 at 20:43

The first problem is that you substituted $x=\frac12(1-a)$ into $f(x)$ incorrectly; the second (and more important) problem is that you need to define a new function whose independent variable is $a$. Specifically, let $g(a)$ be the maximum attained by the function $f(x)=ax(1-x-a)$; you want to find the value of $a$ that maximizes $g(a)$. Substituting $x=\frac12(1-a)$ into $f(x)$, we find that

\begin{align*} g(a)&=a\left(\frac{1-a}2\right)\left(1-\frac{1-a}2-a\right)\\ &=\frac{a}4(1-a)\big(2-(1-a)-2a\big)\\ &=\frac{a}4(1-a)(1-a)\\ &=\frac14\left(a-2a^2+a^3\right)\;. \end{align*}

Now $g'(a)=\frac14\left(1-4a+3a^2\right)$. Setting this equal to $0$, we have $3a^2-4a+1=0$. To solve for $a$ you can either use the quadratic formula or notice that $3a^2-4a+1=(3a-1)(a-1)$; either way, you find that $g'(a)=0$ for $a=1$ and $a=\frac13$. By analyzing the sign of $g'(a)$ or by using the second derivative test you can check that $g(a)$ has a local maximum (of $\frac1{27}$) at $a=\frac13$ and a local minimum (of $0$) at $a=1$.

However, a quick check of the graph of $g(a)$ will show you that it increases without bound as $a\to\infty$, and this is also clear algebraically: as $a\to\infty$, $1-a\to-\infty$, so $\frac14a(1-a)^2\to\infty$. Thus, you can make the maximum of $f(x)$ as large as you want by choosing $a$ large enough.

-
@Théophile: Done! – Brian M. Scott Jul 20 '12 at 21:32

The maximum value of the function, which occurs at $x = \frac{1-a}{2}$, is: \begin{align}f\big(\frac{1-a}{2}\big) & = a\big(\frac{1-a}{2}\big)(1-\frac{1-a}{2}-a)\\ &= a\big(\frac{1-a}{2}\big)\bigl(\frac{1-a}{2}\bigr)\\ &= a\big(\frac{1-a}{2}\big)^2. \end{align}

As $a \rightarrow \infty$, this grows without bound.

-
By the way, note that you don't need calculus to maximize $f(x)$: it is a downward parabola with roots at $0$ and $1−a$, so the $x$-value of the maximum lies halfway between these. – Théophile Jul 20 '12 at 21:29

Before we start differentiating, let's think about $f(x)$ a bit. Let $x=-100$, and let $a=102$. Then $f$ is large. It can be made arbitrarily large by choosing positive $a$ suitably.

If one wants a maximum to exist, the problem needs to be modified. For example, instead of $a\gt 0$, you could specify that $0\lt a\lt 1$, or equivalently that the maximum occurs at a positive value of $x$.

-

Once you insert $x = \dfrac{1-a}{2}$, you can no longer differentiate it since $a$ is a constant and differentiating $f(a)$ will lead to $0$. At best, you can find out $f'(x)$ and substitute the value of x in terms of a to re-verify it is 0 (but then, that's how you got $x = \dfrac{1-a}{2}$ to begin with)

-
No, you can define a new function $g(a)=\max_x f(x)$ and try to maximize $g$. – Brian M. Scott Jul 20 '12 at 21:30

We can resort to some algebra along with the calculus you are using, to see what happens with this function:

$$f(x)=ax(1−x−a)=-ax^2+(a-a^2)x$$

Note that this is a parabola. Since the coefficient of the $x^2$ term is negative, it opens downward so that the maximum value is at the vertex. As you have already solved, the vertex has x-coordinate $x=\frac{1−a}{2}$. Additionally, Théophile showed that the vertex's y-coordinate is $f(\frac{1−a}{2})=a(\frac{1−a}{2})^2$ which is unbounded as $a$ increases.

-