# Is linear function convex or concave?

I was wondering if linear function is convex or concave? For example f(x)=x, is function whose second derivate is 0 so we cant tell anything using this criteria. Can someone help?

• take any two points on the graph... where would be the line joining those two points present?
– user87543
Dec 18, 2013 at 12:06

A linear function is both. Use this definition of convexity:

For any two points $x_1$ and $x_2$ $$\forall a \in [0,1] \quad f(ax_1 + (1-a)x_2) \leq af(x_1) + (1-a)f(x_2)$$

Flip inequality for concave. Do you see why linear is both?

• I don't get it. Linear is supposed to be f(cx1+bx2) = cf(x1) + bf(x2) where c and b are real numbers and x1 and x2 are elements of the domain/I/interval/whatever right? The definition of convex and concave use a and 1-a which only covers numbers in [0,1] so how are we extending this to all real numbers from just [0,1]?
– BCLC
Dec 16, 2014 at 20:15
• Exactly my point. To prove convexity, you simply pick the coefficients as mentioned above. Convexity requires that coefficints be in $[0,1]$. Linearity covers this and far more!! That too with equality. Dec 18, 2014 at 3:27
• Hahaha sorry. I misread the question. Linear is convex and concave but the link to the answer below says iff
– BCLC
Dec 18, 2014 at 7:03

Linear function is both convex and concave. You may be interested in this page.

• I don't get it. Linear is supposed to be f(ax1+bx2) = af(x1) + bf(x2) where a and b are real numbers and x1 and x2 are elements of the domain/I/interval/whatever right? The definition of convex and concave uses $\lambda$ and 1-$\lambda$ which only cover numbers in [0,1] so how are we extending this to all real numbers from just [0,1]?
– BCLC
Dec 16, 2014 at 20:14
• I don't think you need to extend to all real numbers. You already know that it's true for all real numbers which implies it's also true for [0, 1]. Nov 5, 2016 at 14:21