I have a big matrix and each element of it has many stuff. The problem I'm facing is that the align mode is trying to make each equation to be fitted into one page. For example, in the following code I have a matrix in a separate align mode and its elements in another align equation as follows
\documentclass[12pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
P =
\left[
\begin{array}{ccccc}
P_{11} & P_{12} & P_{13} & P_{14} \\
P_{21} & P_{22} & P_{23} & P_{24} \\
P_{31} & P_{32} & P_{33} & P_{34} \\
\end{array}
\right]
\end{align*}
where
\begin{align*}
P_{11} &= XXXXXXXXXXXXX \\
P_{12} &= XXXXXXXXXXXXX \\
P_{13} &= XXXXXXXXXXXXX \\
P_{14} &= XXXXXXXXXXXXX \\
%%%%%%%%%%%%%%%%%%%%%%%%%%
P_{21} &= XXXXXXXXXXXXX \\
P_{22} &= XXXXXXXXXXXXX \\
P_{23} &= XXXXXXXXXXXXX \\
P_{24} &= XXXXXXXXXXXXX \\
%%%%%%%%%%%%%%%%%%%%%%%%%%
P_{31} &= XXXXXXXXXXXXX \\
P_{32} &= XXXXXXXXXXXXX \\
P_{33} &= XXXXXXXXXXXXX \\
P_{34} &= XXXXXXXXXXXXX \\
\end{align*}
\end{document}
From the below picture, the elements of the matrix are taking more than one page in my actual case, so the elements have been placed in a separate page. The previous page is having only the actual matrix (i.e. P) , therefore the page almost empty. How can I force the equation mode to be in the line text.


