# How to tell a function is convex?

## Question:

How to tell a function is convex?

## Concavity of Function:

First we need to understand the concavity of a function to solve this problem:

Concave up/ Concave: {eq}y = f(x) {/eq} is concave up on an interval {eq}I {/eq} when the double derivative is greater than zero which means: {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 double derivative is greater than zero which means: {eq}\displaystyle f''(x) < 0 {/eq} on the interval {eq}I {/eq}.

We will understand the convex function using the example. Compute the convex of the given function {eq}f(x) = - 3 x^2 + 18 x + 4 {/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 the convex on the interval {eq}\displaystyle \left (- \infty, \infty \right) {/eq}.