

#Probing convexity of some functions planted as exercises

For all problems we asume that $x_1, x_2 \in {\rm I\!R}$ and we  asume that $z = \alpha x_1 + (1 - \alpha)x_2$, is usable in all functions for probing the convexity and for last we asume that $\alpha \in [0,1]$

1. Show that $f(x) = a \cdot x + b$ is convex, $x \in {\rm I\!R}$

\begin{equation}
\begin{split}
& f(z) = f(\alpha x_1 + (1 - \alpha) x_2)\\
& f(z) = a (\alpha x_1 + (1 - \alpha) x_2) + b \\
& f(z) = a  \alpha x_1 + a(1-\alpha) x_2 + b \\
& f(z) = a  \alpha x_1 + a(1-\alpha) x_2 + b + \alpha b - \alpha b\\
& f(z) = a  \alpha x_1 + \alpha b  + a(1-\alpha) x_2 + b - \alpha b\\
& f(z) = \alpha (a x_1 + b) + a(1-\alpha)x_2 + b(1 - \alpha)\\
& f(z) = \alpha ( a x_1 + b) + (1-\alpha) (a x_2 + b)\\
& f(z) = \alpha f(x_1) + (1-\alpha) f(x_2)
\end{split}
\end{equation}

2. Show that $f(x) = ax^2  + b$ is convex, $x \in {\rm I\!R}$

\begin{equation}
\begin{split}
& f(z) = f(\alpha x_1 + (1 - \alpha) x_2)\\
& f(z) = a (\alpha x_1 + (1 - \alpha)x_2)^2 + b\\
& f(z) = a ( [\alpha x_1]^2 + 2 [\alpha x_1 + (1 - \alpha)x_2] + [(1 - \alpha)x_2]^2) + b\\
& f(z) = a(\alpha x_1)^2 + 2a(\alpha x_1 + (1 - \alpha)x_2) + a[(1 - \alpha)x_2]^2 + b\\
& f(z) = a(\alpha x_1)^2 + 2a\alpha x_1 + 2a(1 - \alpha)x_2 + a[(1 - \alpha)x_2]^2 + b\\
& f(z) = a(\alpha x_1)^2 + 2a\alpha x_1 + \alpha b + 2a(1 - \alpha)x_2 + a[(1 - \alpha)x_2]^2 + b - \alpha b\\
& f(z) = a(\alpha x_1)^2 + 2a\alpha x_1 + \alpha b + 2a(1 - \alpha)x_2 + a[(1 - \alpha)x_2]^2 + b  (1 - \alpha)\\
& f(z)= a(\alpha x_1)^2 + 2a\alpha x_1 + \alpha b + (1- \alpha)(2a + b) + a[(1 - \alpha)x_2]^2 \\
& f(z)= a(\alpha x_1)^2 + \alpha (2ax_1 + b) + (1- \alpha)(2a + b) + a[(1 - \alpha)x_2]^2
\end{split}
\end{equation}

3. Show that $g(x) = af(x) + b$ is convex, where $f(x)$ is a convex function, $x \in {\rm I\!R}$

\begin{equation}
\begin{split}
& f(z) = f(\alpha x_1 + (1-\alpha)x_2)\\
& g(x) = a f(x) + b\\
& g(x) = a f(z) + b\\
& g(x) = a f(\alpha x_1 + (1-\alpha)x_2) + b\\
& g(x) = a [\alpha f(x_1) + (1-\alpha) f(x_2)] + b\\
& g(x) = a \alpha f(x_1) + a (1 - \alpha) f(x_2) + b\\
& g(x) = a \alpha f(x_1) + a (1 - \alpha) f(x_2) + b + \alpha b - \alpha b\\
& g(x) = a \alpha f(x_1) + \alpha b + a (1 - \alpha) f(x_2) + b - \alpha b\\
& g(x) = \alpha (a f(x_1) + b) + a (1 - \alpha) f(x_2) + b (1 - \alpha)\\
& g(x) = \alpha (a f(x_1) + b) + (1 - \alpha) (a f(x_2) + b)\\
& g(x) = \alpha g(x_1) + (1 - \alpha) g(x_2)\\
\end{split}
\end{equation}

4. Show that, if $f(x)$ is convex, then $g(x) = f(ax+b)$ is convex as well

\begin{equation}
\begin{split}
& f(z) = f(\alpha x_1 + (1 - \alpha)x_2)\\
& g(x) = f(a x + b)\\
& g(x) = f(a (\alpha x_1 + (1 - \alpha)x_2) + b)\\
& g(x) = f(a\alpha x_1 + a(1 - \alpha)x_2 + b)\\
& g(x) = f(a\alpha x_1 + a(1 - \alpha)x_2 + b + \alpha b - \alpha b)\\
& g(x) = f(a\alpha x_1 + \alpha b  + a(1 - \alpha)x_2 + b - \alpha b)\\
& g(x) = f(\alpha [a x_1 + b]  + a [1 - \alpha] x_2 + b [1 - \alpha])\\
& g(x) = f(\alpha [a x_1 + b]  + [1 - \alpha] [a  x_2 + b])\\
& g(x) = \alpha f(a x_1 + b)  + (1 - \alpha) f(a  x_2 + b)\\
& g(x) = \alpha g(x_1)  + (1 - \alpha) g(x_2)\\
\end{split}
\end{equation}

5531e227f146a310810ed3b16447d6ebe6147070
ipynb
Jupyter Notebook
Practice/First exam/Convexity.ipynb
QuantumGorilla/Optimization
ed7dc755cb1346d208f5f33fc4814e3931c9b44d
MIT
Practice/First exam/Convexity.ipynb
QuantumGorilla/Optimization
ed7dc755cb1346d208f5f33fc4814e3931c9b44d
MIT
Practice/First exam/Convexity.ipynb
QuantumGorilla/Optimization
ed7dc755cb1346d208f5f33fc4814e3931c9b44d
MIT
Qwen/Qwen-72B
1. YES
2. YES