# Gaussian integration step for exponential tail bound of Chi squared variable

I am reading a recent book on statistical learning theory and am stuck on understanding a step in the derivation of an exponential tail bound of Chi squared variables. In the following, $$X_i$$ is a sub-Gaussian variable over $$\mathbb{R}$$ with zero mean and variance smaller than $$b_i$$. The goal of this part of the proof is to bound $$\log \mathbb{E}_{X_i} \exp(\lambda X_i^2)$$ for a fixed $$\lambda > 0$$. To do so, the book introduces $$\xi \sim \mathcal{N}(0, 1)$$ which is independent from $$X_i$$ and proceeds as follows: \begin{align} \log \mathbb{E}_{X_i} \exp(\lambda X_i^2) & = \log \mathbb{E}_{X_i} \mathbb{E}_{\xi} \exp(\sqrt{2\lambda} \xi X_i) \\ & = \log \mathbb{E}_{\xi} \mathbb{E}_{X_i} \exp(\sqrt{2\lambda} \xi X_i) \\ & \leq \log \mathbb{E}_{\xi} \exp(\lambda \xi^2 b_i) \\ & = -\frac{1}{2} \log(1 - 2\lambda b_i), \end{align} where the first and last equalities are obtained with Gaussian integration, the inequality is obtained using the fact that $$X_i$$ is sub-Gaussian with variance bounded by $$b_i$$. The only steps I don't understand are the first and last steps. The only thing that the book says about these steps is that they are obtained with Gaussian integration. Can someone explain how to justify these steps? Thanks.

The trick is to use the MGF of a Gaussian variable. For a N(0, $$\sigma^2$$)-distributed variable, this is given by $$E(e^{t\xi}) = e^{\sigma^2t^2/2}.$$ Find suitable values of $$t$$ and $$\sigma$$ and the result follows.