How to prove the following by Cauchy-Schwarz? [duplicate]

If

$$u(x) \in C([a, b]), u(a) = 0,\; u(x) = \int_{a}^{x}u^{'}(t)dt$$

then

$$\int_{a}^{b} |u|^{2} dx \le \frac{1}{2}(b - a)^{2}\int_{a}^{b}|u^{'}(t)|^{2}dt$$

The book said it can be proved using cauchy-schwarz-inequality, but I cannot make it.

marked as duplicate by Martin R, mrtaurho, idm, Macavity inequality StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Dec 22 '18 at 18:45

One long line proves it: $$\int_a^b |u(t)|^2 dt=\int_a^b\left|\int_a^t 1\cdot u'(t')dt'\right|^2 dt\le\int_a^b\left[\int_a^t 1^2 dt'\cdot\int_a^t |u'(t')|^2dt'\right] dt\\\le\int_a^b\left[(t-a)\cdot\int_a^b |u'(t')|^2dt'\right] dt=\frac{(b-a)^2}{2}\int_a^b |u'(t')|^2dt'.$$The first $$\le$$ uses Cauchy-Schwarz; the second replaces an $$\int_a^t dt'$$ with $$\int_a^b dt'$$.