[proofplan]
We first verify that the affine transform $aX+b$ has finite second moment, so its variance is defined. Then we compute its expectation using linearity of the [Lebesgue integral](/page/Lebesgue%20Integral) with respect to the probability measure $\mathbb P$. Finally, we center $aX+b$ and observe that the constant shift $b$ cancels, leaving a factor $a$ inside the square and hence a factor $a^2$ outside the expectation.
[/proofplan]
[step:Verify that the affine transform is square-integrable]
Define the [random variable](/page/Random%20Variable)
\begin{align*}
Y:(\Omega,\mathcal F)&\to(\mathbb R,\mathcal B(\mathbb R))\\
\omega&\mapsto aX(\omega)+b.
\end{align*}
Since $X$ is measurable and affine maps $\mathbb R\to\mathbb R$ are Borel-measurable, $Y$ is a real-valued random variable. In this proof, for any integrable real-valued random variable $Z: (\Omega,\mathcal F)\to(\mathbb R,\mathcal B(\mathbb R))$, the expectation is
\begin{align*}
\mathbb E[Z]:=\int_\Omega Z(\omega)\,d\mathbb P(\omega),
\end{align*}
and for any square-integrable real-valued random variable $Z$, its variance is
\begin{align*}
\operatorname{Var}(Z):=\mathbb E\left[(Z-\mathbb E[Z])^2\right].
\end{align*}
For every $\omega\in\Omega$, applying the elementary inequality $|u+v|^2\le 2|u|^2+2|v|^2$ with $u=aX(\omega)$ and $v=b$ gives
\begin{align*}
|Y(\omega)|^2
=|aX(\omega)+b|^2
\le 2a^2|X(\omega)|^2+2b^2.
\end{align*}
Integrating this inequality with respect to $\mathbb P$ gives
\begin{align*}
\mathbb E[Y^2]
=\int_\Omega |Y(\omega)|^2\,d\mathbb P(\omega)
\le 2a^2\int_\Omega |X(\omega)|^2\,d\mathbb P(\omega)+2b^2\mathbb P(\Omega)
<\infty,
\end{align*}
because $\mathbb E[X^2]<\infty$ and $\mathbb P(\Omega)=1$. Hence $Y=aX+b$ is square-integrable.
[/step]
[step:Compute the expectation of $aX+b$]
Since $X$ is square-integrable, it is integrable: for every $\omega\in\Omega$,
\begin{align*}
|X(\omega)|\le \frac{1+|X(\omega)|^2}{2},
\end{align*}
and the right-hand side has finite $\mathbb P$-integral. Therefore $\mathbb E[X]$ is finite. By the linearity theorem for the Lebesgue integral applied with respect to the measure $\mathbb P$,
\begin{align*}
\mathbb E[Y]
&=\int_\Omega \bigl(aX(\omega)+b\bigr)\,d\mathbb P(\omega)\\
&=a\int_\Omega X(\omega)\,d\mathbb P(\omega)+b\int_\Omega 1\,d\mathbb P(\omega)\\
&=a\mathbb E[X]+b.
\end{align*}
[guided]
We need the expectation of $Y=aX+b$ before we can compute the variance, because variance is defined by centering around the expectation. First, $\mathbb E[X]$ is finite. Indeed, for every $\omega\in\Omega$,
\begin{align*}
|X(\omega)|\le \frac{1+|X(\omega)|^2}{2}.
\end{align*}
The function on the right has finite integral with respect to $\mathbb P$, since $\mathbb P(\Omega)=1$ and $\mathbb E[X^2]<\infty$. Hence $X$ is integrable.
Now apply the linearity theorem for the Lebesgue integral with respect to $\mathbb P$ to the integrable function $X:\Omega\to\mathbb R$ and the constant function $\omega\mapsto b$. We obtain
\begin{align*}
\mathbb E[Y]
&=\int_\Omega Y(\omega)\,d\mathbb P(\omega)\\
&=\int_\Omega \bigl(aX(\omega)+b\bigr)\,d\mathbb P(\omega)\\
&=a\int_\Omega X(\omega)\,d\mathbb P(\omega)+b\int_\Omega 1\,d\mathbb P(\omega)\\
&=a\mathbb E[X]+b\mathbb P(\Omega)\\
&=a\mathbb E[X]+b.
\end{align*}
The important point is that the additive constant contributes exactly $b$ to the expectation because $\mathbb P$ is a probability measure.
[/guided]
[/step]
[step:Center the affine transform and factor out the scalar]
Using the expectation computed above, for every $\omega\in\Omega$ we have
\begin{align*}
Y(\omega)-\mathbb E[Y]
&=aX(\omega)+b-\bigl(a\mathbb E[X]+b\bigr)\\
&=a\bigl(X(\omega)-\mathbb E[X]\bigr).
\end{align*}
Therefore, by the definition of variance stated above,
\begin{align*}
\operatorname{Var}(Y)
&=\mathbb E\left[\bigl(Y-\mathbb E[Y]\bigr)^2\right]\\
&=\int_\Omega \bigl(Y(\omega)-\mathbb E[Y]\bigr)^2\,d\mathbb P(\omega)\\
&=\int_\Omega a^2\bigl(X(\omega)-\mathbb E[X]\bigr)^2\,d\mathbb P(\omega)\\
&=a^2\int_\Omega \bigl(X(\omega)-\mathbb E[X]\bigr)^2\,d\mathbb P(\omega)\\
&=a^2\operatorname{Var}(X),
\end{align*}
where the penultimate equality uses the linearity theorem for the Lebesgue integral for the constant scalar $a^2$, and the last equality uses the definition of $\operatorname{Var}(X)$. Since $Y=aX+b$, this proves
\begin{align*}
\operatorname{Var}(aX+b)=a^2\operatorname{Var}(X).
\end{align*}
[/step]