What is the largest possible value of $f(4)$? 
Q. Assume the function $f : \mathbb R \to \mathbb R$ is continuously differentiable on $\mathbb R$. Assume also that $f(0) = 0$ and $f(x)f^\prime(x) \le 2$ for all $x \in \mathbb R$. What is the largest possible value of $f(4)$? (Hint: in your answer, you need to show that a larger value cannot be obtained; you must also show that the value you give actually is attained by at least one function.) 

I think $f(x) = \sqrt2 \sin(x)$ satisfies the above conditions. But, I don't know how to answer the largest possible value of $f(4)$. Do I just sub $4$ in to $x$ (i.e. $f(4) = \sqrt \sin (4)$)? 
 A: As Tsemo Aristide's answer already indicates, the key insight in this problem is that $f(x) f'(x) = \frac{1}{2} \frac{d}{dx} [(f(x))^2]$.  Therefore, if $f(x) f'(x) \le 2$, then integrating both sides on $[0,4]$, we get:
$$(f(4))^2 = (f(4))^2 - (f(0))^2 = 2 \int_0^4 f(x) f'(x) dx \le 2 \int_0^4 2\, dx = 16.$$
Therefore, $f(4) \le 4$.
Reversing this, we also get an idea of what we would need to happen in order to get a value of 4 to be achieved.  Namely, we would need $\frac{d}{dx} (f(x))^2 \equiv 4$ for $x \in [0, 4]$.  Therefore, $f(x)^2 = 4x + C$; and since $f(0) = 0$, we get $f(x)^2 = 4x$.  In order to get a positive value of $f(4)$, we would select the solution $f(x) = \sqrt{4x}$.
But wait: There's a problem with this function.  Namely, it is only defined for $x \in [0, \infty)$, whereas we wanted to have a function defined on all of $\mathbb{R}$.  Furthermore, since $\lim_{x \to 0^+} f'(x) = \infty$, there is no hope of extending this function to all of $\mathbb{R}$ in such a way that $f$ becomes continuously differentiable.
In fact, if we look back at the original argument, we can see why 4 cannot be obtained as a value of $f(4)$.  Namely, define $g(x) = f(x) f'(x)$.  Then $g$ is a continuous function on $\mathbb{R}$; $g(0) = 0$; and $g(x) \le 2$ for all $x \in \mathbb{R}$.  It follows that we have a strict inequality $(f(4))^2 = 2 \int_0^4 g(x) dx < \int_0^4 4\,dx = 16$, so $f(4) < 4$.
On the other hand, the analysis above gives an idea for how we might construct functions $f$ which come very close to having $f(4) = 4$: fix $g$ to be a continuous function with $g(0) = 0$, and $g(x) \le 2$ for all $x$, but such that $g(x)$ increases towards 2 very rapidly as $x$ increases from 0.  Then define $G(x) = 2 \int_0^x g(t) dt$ and $f(x) = \sqrt{G(x)}$.  Then $f'(x) = \frac{G'(x)}{2 \sqrt{G(x)}} = \frac{g(x)}{\sqrt{G(x)}}$, and $f(x) f'(x) = g(x) \le 2$.  The only case to watch out for, in checking $f$ is continuously differentiable, is if $G(x) = 0$, in which case you will have to check more closely.  Furthermore, $f(0) = \sqrt{G(0)} = \sqrt{0} = 0$; and $G(4) = 2 \int_0^4 g(t)\,dt$ will be very close to $2 \int_0^4 2\,dt = 16$, so $f(4)$ will be very close to 4.
To make some concrete examples, suppose we set $g_n(x) = 2 \left(1 - \frac{1}{(1+nx)^2}\right)$, so that $G_n(x) = 4x + \frac{4}{n(1+nx)} - \frac{4}{n} = 4x - \frac{4x}{1+nx} = \frac{4n x^2}{1+nx}$ and $f_n(x) = \sqrt{G_n(x)} = 2x \sqrt{\frac{n}{1+nx}}$.  Then a quick calculation with the definition of derivative shows $f_n'(0) = 2\sqrt{n}$ and the derivative is continuous at $x=0$.  Also, $f_n(4) = 8 \sqrt{\frac{n}{1+4n}} \to 4$ as $n \to \infty$. 
 However, there is one problem: $f_n(x)$ is defined only for $x > -\frac{1}{n}$.  To fix this, we will replace the function for negative $x$ by $2x \sqrt{n}$.  On this part of the domain, we will have $f(x) < 0$ and $f'(x) > 0$ so $f(x) f'(x) < 0 \le 2$.  We also chose the slope to match the value of $f_n'(0)$ from the original function, so the gluing will result in another continuously differentiable function.
To summarize the last paragraph: define
$$ f_n(x) = \begin{cases} 2x \sqrt{\frac{n}{1+nx}}, & x \ge 0; \\
2x \sqrt{n}, & x < 0. \end{cases} $$
Then $f_n$ satisfies the required conditions from the questions.  Furthermore, $f_n(4) = 8 \sqrt{\frac{n}{1+4n}}$ gets arbitrarily close to 4.

So, the question as stated is incorrect: there is no maximum value for $f(4)$ that can be achieved.  The supremum of possible values for $f(4)$ is 4; however, for any actual function $f$ satisfying the conditions, we have $f(4) < 4$.
A: You have ${d\over{dx}}(f(x))^2\leq 4$ implies that $(f(x))^2\leq 4x$ you deduce that $f(x)\leq 2\sqrt x$
