This is LaTeX code:

[latex]
\begin{array}{rcl}
x(0) &=& A\cos0+B\sin0+\frac{mg}{k}= \\
 & =& A+\frac{mg}{k} = \\
 &=& 0
\end{array}
[/latex]