Application of martingale convergence theorem I am struggling with this question:
Let $(X_n : n \geq 1)$ be a zero mean martingale in $L^2$. Show that, for $\lambda >0$,
\begin{equation}
\mathbb{P} \bigg( \max_{1 \leq k \leq n} X_k \geq \lambda \bigg) \leq \frac{\mathbb{E} [{X_n}^2]}{{\lambda}^2 + \mathbb{E} [{X_n}^2]}.
\end{equation}
This question gives a hint that martingale convergence theorem and the fact that the function $x  \mapsto  (x+c)^2$ is convex are needed.
 A: Here is a solution with more details. 
Since $y\mapsto (y+c)^2$ is a convex function, and $Y_{n}$ was hypothesized to be MG, so we must have $(Y_{n}+c)^{2}$ is a sub-MG.
Therefore, we can apply doob's inequality and note that if $Y_{k}\geq y>0$, then $(Y_{k}+c)^{2}\geq (y+c)^{2}$, so that $$\mathbb{P}\Big(\max_{k=0}^{n}Y_{k}\geq y\Big)\leq\mathbb{P}\Big(\max_{k=0}^{n}(Y_{k}+c)^{2}\geq (y+c)^{2}\Big)\leq\dfrac{\mathbb{E}(Y_{n}+c)^{2}}{(y+c)^{2}}\ \ (*)$$
Now, since $Y_{n}$ is a MG, we have $\mathbb{E}Y_{n}=\mathbb{E}Y_{0}=0$ for all $n$, so that $$(*)=\dfrac{\mathbb{E}Y_{n}^{2}+c^{2}}{(y+c)^{2}}\ \ (**)$$
Note that this holds for all $c$ arbitrary, so we can maximize $(**)$ by differentiating it with respect to $c$ and set it to be $0$, i.e., after some algebra, we have $$2c(y+c)-2\mathbb{E}Y_{n}^{2}-2c^{2}=0.$$
This gives us the maximum achieving at $c=\dfrac{\mathbb{E}Y_{n}^{2}}{y}$.
So we plug in this point back to $(**)$ in order to get the maximum value, so plugging in, we have 
\begin{align*}
(**)&=\dfrac{\mathbb{E}Y_{n}^{2}+(\mathbb{E}Y_{n}^{2}/y)^{2}}{(y+\mathbb{E}Y_{n}^{2}/y)^{2}}\\
&=\dfrac{y^{2}\mathbb{E}Y_{n}^{2}+(\mathbb{E}Y_{n}^{2})^{2}}{(y^{2}+\mathbb{E}Y_{n}^{2})^{2}}\\
&=\dfrac{\mathbb{E}Y_{n}^{2}(y^{2}+\mathbb{E}Y_{n}^{2})}{(y^{2}+\mathbb{E}Y_{n}^{2})^{2}}\\
&=\dfrac{\mathbb{E}Y_{n}^{2}}{y^{2}+\mathbb{E}Y_{n}^{2}}.
\end{align*}
Note that this final value is the maximum so provides you the desired inequality. 
A: To continue the hint: we have by Doob's inequality, for $c\gt 0$:
$$\mathbb P\left(\max_{1\leqslant k\leqslant n}X_k\geqslant \lambda\right)=\mathbb P\left(\max_{1\leqslant k\leqslant n}(X_k+c)^2\geqslant (\lambda+c)^2\right)\leqslant \frac 1{(\lambda+c)^2}\mathbb E[(X_n+c)^2].$$
This is what we have to optimize over $c$ (the equality is true for each $c$, hence we can minimize over $c$).
