# Show how to prove a function is convex.

## Question:

Show how to prove a function is convex.

## Concavity of Function:

For proving a convex function we need to understand both concave and convex functions:

Concave up/ Concave: {eq}y = f(x) {/eq} is concave up on an interval {eq}I {/eq} when the second derivative is greater than zero that is: {eq}\displaystyle f''(x) > 0 {/eq} on the interval {eq}I {/eq}.

Concave down / Convex: {eq}y = f(x) {/eq} is concave down on an interval {eq}I {/eq} when the second derivative is greater than zero that is: {eq}\displaystyle f''(x) < 0 {/eq} on the interval {eq}I {/eq}.

We can understand the convex function using an example. Prove that the given function {eq}\displaystyle f(x) = - 3 x^2 + 18 x + 4 {/eq} is a convex function for all real values of {eq}x {/eq}.

Take the derivative of {eq}f(x) {/eq} with respect to x

\begin{align*} \displaystyle f'(x) &= \frac{d}{dx} [- 3 x^2 + 18 x + 4 ] \\ &= - 3 \times 2 x + 18 \times 1 + 0 &\text{(Differentiating using the power formula } \frac{d}{dx}[x^n] = n x^{n - 1} \text{)}\\ &= - 6 x + 18 \\ f''(x) &= \frac{d}{dx}[ - 6 x + 18] &\text{(Taking the derivative of } f'(x) \text{ with respect to x)}\\ &= - 6 \times 1 + 0 &\text{(Differentiating using the power formula } \frac{d}{dx}[x^n] = n x^{n - 1} \text{)}\\ &= - 6 \\ \end{align*}

Here {eq}f''(x) < 0 {/eq} for all real values of x, so {eq}f(x) {/eq} is a convex function on for all real values of x.