# Is it $g(\alpha X+\beta Y) =g(\alpha)X+g(\beta)Y$ right?

Consider an example of Jensen's inequality in Probability. Let $$X(\omega)=x\mathbf{1}_{A}(\omega)+y\mathbb{1}_{A^{c}}(\omega)$$, for some $$x, y\in \mathbb{R}$$ such that $$\mathbb{P}(A)=\lambda$$. We have $$g(X(\omega))=g(x)\mathbf{1}_{A}(\omega)+g(y)\mathbb{1}_{A^{c}}(\omega)$$

Why above equality is right? I cannot understand that it because it is the same with $$g(\alpha X+\beta Y) =g(\alpha)X+g(\beta)Y$$. How to prove it?

For any $$\omega$$ either $$\omega \in A$$ or $$\omega \in A^{c}$$. In the first case both sides of the equation are $$g(x)$$ and in the second case both sides are $$g(y)$$ so the equation is true.
$$g(\alpha X+\beta Y)=g(\alpha)X+g(\beta)Y$$ is not true in general.