Show $|x-1|$ and $|2x-1|$ are convex functions using the fact that a convex function $f:\mathbb{R} \rightarrow \mathbb{R}$ satisfies: for any $x^{(1)},x^{(2)}\in\mathbb{R}$ and $\lambda_1,\lambda_2 \geq0$, where $\lambda_1+\lambda_2=1$ we have $f(\lambda_1x^{(1)}+\lambda_2x^{(2)})\leq\lambda_1f(x^{(1)})+\lambda_2f(x^{(2)})$

I figured out how to solve this for $|x|$ but I am having a hard time applying the same ideas to $|ax-b|$.

For $f(x)=|x|$ I did:

$\begin{align} f(\lambda_1x^{(1)}+\lambda_2x^{(2)}) &= |\lambda_1x^{(1)}+\lambda_2x^{(2)}| \\&\leq |\lambda_1x^{(1)}|+|\lambda_2x^{(2)}| \\&= \lambda_1|x^{(1)}|+\lambda_2|x^{(2)}| \\&= \lambda_1f(x^{(1)})+\lambda_2f(x^{(2)}) \end{align}$

  • $\begingroup$ Use that $\lambda_1 + \lambda_2 = 1$. $\endgroup$
    – user251257
    Jul 19 '17 at 22:10
  • $\begingroup$ A V-shaped graph is pretty convex. $\endgroup$ Jul 19 '17 at 22:16

Put $f(x)=|x-1|$ and $g(x)=|2x-1|$. Then for any $x_1,x_2\in\mathbb R$ and $\lambda_1,\lambda_2\geq0$ with $\lambda_1+\lambda_2=1$, we have \begin{align*} f(\lambda_1x_1+\lambda_2x_2)&=|\lambda_1x_1+\lambda_2x_2-1|\\ &=|\lambda_1x_1-\lambda_1+\lambda_2x_2-\lambda_2|\\ &\leq|\lambda_1x_1-\lambda_1|+|\lambda_2x_2-\lambda_2|\\ &=\lambda_1f(x_1)+\lambda_2f(x_2). \end{align*} So $f$ is convex, and the proof that $g$ is convex is similar.


Composition of a convex function with an affine function is a convex function. See also Composition of convex function and affine function


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.