# Gamma distribution of maximal variance by Lagrange multiplier

A $Gamma(\alpha,\beta)$ random variable has probability density function

$$f(x)=\frac{\beta^{\alpha}}{\Gamma(\alpha)}x^{\alpha-1} e^{-\beta x}, x\geqslant 0$$

with $\mathbb{E}(X)=\frac{\alpha}{\beta}$ and $Var(X)=\frac{\alpha}{\beta^2}$ .

Find $Gamma(\alpha,\beta)$ distribution of maximal variance, subject to $\alpha = \beta - 1$ , using Lagrange multipliers and second derivative test.

I have been using Lagrange multipliers in constrained optimisations of multivariate functions, but do not know how to start in this single-variable case.

Your problem is not a single variate case. You have two variables, $$\alpha$$ and $$\beta$$. The lagrange function is

$$\mathcal L=\frac{\alpha}{\beta^2}+\lambda \cdot (1-\beta+\alpha)$$

The corresponding conditions are

$$\frac{\partial \mathcal L}{\partial \alpha}=\frac1{\beta^2}+\lambda =0$$

$$\frac{\partial \mathcal L}{\partial \beta}=-2\frac{\alpha}{\beta^3}-\lambda =0$$

$$\frac{\partial \mathcal L}{\partial \lambda}=1-\beta+\alpha =0$$

Solve the equation system to obtain $$\lambda^*,\alpha^*, \beta^*$$

Then use the $$\texttt{bordered Hessian}$$ to evaluate if the stationary point is a (local) maximum or (local) minimum.

$$\tilde H=\left( \begin{array}{} 0 & \frac{\partial^2 \mathcal L}{\partial \lambda\partial \alpha}& \frac{\partial^2 \mathcal L}{\partial \lambda\partial \beta} \\ \frac{\partial^2 \mathcal L}{\partial \lambda\partial \alpha} & \frac{\partial^2 \mathcal L}{\partial \alpha\partial \alpha} & \frac{\partial^2 \mathcal L}{\partial \alpha\partial \beta} \\ \frac{\partial^2 \mathcal L}{\partial \lambda\partial \beta} & \frac{\partial^2 \mathcal L}{\partial \alpha\partial \beta} & \frac{\partial^2 \mathcal L}{\partial \beta\partial \beta} \end{array}\right)$$

If $$det \ \tilde H(\lambda^*,\alpha^*, \beta^*) >0 \Rightarrow \texttt{it´s a (local) maximum}$$

If $$det \ \tilde H(\lambda^*,\alpha^*, \beta^*) <0 \Rightarrow \texttt{it´s a (local) minimum}$$