# What are two convex functions, f and g, such that the composition f(g(x)) is not convex?

### 1 Answer | Add Yours

A function f(x) is convex if f''(x) >= 0 for all x.

Now we have to find two functions f(x) and g(x) such that they are convex but f(g(x)) is not convex.

If we take f(x) = -x

f'(x) = -1

f''(x) = 0 which is always >=0.

Therefore f(x) = -x is convex.

Take g(x) = x^2

g'(x) = 2x

g''(x) = 2 which is always >=0

Therefore g(x) = x^2 is convex.

Now f(g(x) = f(x^2) = -x^2

f'(g(x)) = -2x

f''(g(x)) = -2 which is not >=0

Therefore f(g(x)) is not convex.

**One example of f(x) and g(x) being convex but f(g(x)) not being convex is f(x) = -x and g(x) = x^2.**