Suppose $f$ and $g$ are convex functions from $\mathbb{R}^1\to\mathbb{R}.$ By giving either a proof or counterexample, decide whether the following functions are convex or not.
Hint: think about the functions, $x$ and $-x$
$a)f(x)g(x)$
$b)f(g(x))$
$c)f(x)^3$
By definition
A function $h$ defined on a convex set $S$ in $\mathbb{R}^n$ is called a convex function if $$h(\lambda x_1+(1-\lambda)x_2)\le\lambda h(x_1)+(1-\lambda)h(x_2)$$ for $0\le\lambda\le1, \forall x_1,x_2\in S$
My attempts
$a)$ Not always convex, here is a counter example.
Let $x_1:=2,\space x_2:=1,\space\lambda:=\frac{1}{2},\space f(x):=-x,\space g(x):=x,h(x):=f(x)g(x),\space \text{then }h(x)=-x^2$
That $x$ and $-x$ are both convex
$\text{WTS }h(x) \text{is not convex}$
If not we have:
$$h(\lambda x_1+(1-\lambda)x_2)\le\lambda h(x_1)+(1-\lambda)h(x_2)$$
$$\Rightarrow-(\lambda x_1+(1-\lambda)x_2)^2\le\lambda (-x_1^2)+(1-\lambda)(-x_2^2)$$
$$\Rightarrow-(\frac{1}{2}2+(1-\frac{1}{2})1)^{2}\le\frac{1}{2} (-2^2)+(1-\frac{1}{2})(-1^2)$$
$$\Rightarrow-2.25\le-2.5\tag*{$(\Rightarrow\Leftarrow)$}$$
$b)$ Not always convex, here is a counter example.
Let $x_1:=2,\space x_2:=1,\space\lambda:=\frac{1}{2},\space f(x):=-x,\space g(x):=x^2,h(x):=f(g(x)),\space \text{then }h(x)=-x^2$
That $x^2$ and $-x$ are both convex
$\text{WTS }h(x) \text{is not convex}$
If not we have:$($same as $a))$
$$h(\lambda x_1+(1-\lambda)x_2)\le\lambda h(x_1)+(1-\lambda)h(x_2)$$
$$\Rightarrow-(\lambda x_1+(1-\lambda)x_2)^2\le\lambda (-x_1^2)+(1-\lambda)(-x_2^2)$$
$$\Rightarrow-(\frac{1}{2}2+(1-\frac{1}{2})1)^{2}\le\frac{1}{2} (-2^2)+(1-\frac{1}{2})(-1^2)$$
$$\Rightarrow-2.25\le-2.5\tag*{$(\Rightarrow\Leftarrow)$}$$ $c)$ Not always convex, here is a counter example.
Let $x_1:=2,\space x_2:=1,\space\lambda:=\frac{1}{2},\space f(x):=-x, \space h(x):=f(x)^3,\space \text{then }h(x)=-x^3$
That $-x$ is convex
$\text{WTS }h(x) \text{is not convex}$
If not we have:
$$h(\lambda x_1+(1-\lambda)x_2)\le\lambda h(x_1)+(1-\lambda)h(x_2)$$
$$\Rightarrow -(\lambda x_1+(1-\lambda)x_2)^3\le\lambda (-x_1^3)+(1-\lambda)(-x_2^3)$$
$$\Rightarrow -(\frac{1}{2} 2+(1-\frac{1}{2})1)^3\le\frac{1}{2} (-2^3)+(1-\frac{1}{2})(-1^3)$$
$$\Rightarrow -3.375\le-4.5\tag*{$(\Rightarrow\Leftarrow)$}$$
So all of them are not always convex (is this correct?)$\dots$I'm a little confused about the hint. For example, for $b)$ there is no way to construct a counter example only use $x$ and $-x$.
Thanks for you help.