This is LaTeX code:

[latex]
P\left( {X_n = k} \right) = q\left( \begin{gathered}
 n \hfill \\
 k \hfill \\ 
\end{gathered} \right)\sum\limits_{i = 0}^k {\left( \begin{gathered}
 k \hfill \\
 i \hfill \\ 
\end{gathered} \right)\frac{{\left( { - 1} \right)^i \left( {1 - p} \right)^{n - k + i} }}
{{1 - \left( {1 - q} \right)\left( {1 - p} \right)^{n - k + i} }}} \cdot {\mathbf{1}}_{\left\{ {0,...,n} \right\}} \left( k \right)
[/latex]