Let $f_1, f_2, ......., f_n$ be linearly independent functions. We build the test function $\varphi$ by linearly combining the $f_i$ functions. \begin{equation}\label{ec5} \varphi=c_1 f_1 + c_2 f_2 +........+c_n f_n =\sum_{j}c_i f_i \end{equation} Where $\varphi$ is the test variational function, $c_i$ are variational parameters that must minimize the variational integral. $c_i$ and $f_i$ are real. We establish the variational integral: \begin{equation}\label{ecu6} W=\frac{\int\varphi^{\ast}\hat{H}\varphi dq}{\int\varphi^{\ast}\varphi dq} \end{equation}

We calculate separately the numerator and denominator of the variational integral \begin{equation}\label{ecu7} \int\varphi^{\ast}\varphi dq=\int\sum_{i}c_{i }^{\ast}f_{i}^{\ast}\sum_{j}c_j f_j dq=\sum_{i}c_{i}^{\ast}\sum_{j}c_{j}\int f_ {i}^{\ast}f_j dq=\sum_{i}\sum_{j}c_i c_j S_{ij} \end{equation} Where $S_{ij}$ is the overlap integral. \begin{equation}\label{ecu8} \int\varphi^{\ast}\hat{H}\varphi dq=\int\sum_{i}c_{i}^{\ast}f_{i}^{ \ast}\hat{H}\sum_{j}c_{j}f_{j}=\sum_{i}\sum_{j}c_{i}^{\ast}c_j\int f_{i}^{ \ast}\hat{H}f_j dq=\sum_{i}\sum_{j}c_{i}^{\ast}c_j H_{ij} \end{equation} Substituting the equations (\ref{ecu7}) and (\ref{ecu8}) in (\ref{ecu6}): \begin{equation}\label{ecu9} W=\frac{\sum_{i}\sum_{j}c_{i}c_{j} H_{ij}}{\sum_{i}\sum_{j}c_{i}c_{j}S_{ij}} \end{equation} We are going to minimize W, to get as close as possible to $E_0$. To do this, we derive $W$ with respect to the coefficients $c_k$ of the linear combination, and set the derivatives equal to zero. $\frac{\partial W}{\partial c_k}=0$ with $k=1,2.....n$, returns: $\sum_{i=1}^{n}c_{i }\left(H_{ki}-WS_{ki}\right)=0$ For a test function with two basis functions $\varphi=c_1f_1+c_2f_2$, we obtain the following system: \begin{equation} c_1(H_ {11}-WS_{11})+c_2(H_{12}-WS_{12})=0\\ c_1(H_{21}-WS_{21})+c_2(H_{22}-WS_{22} )=0 \end{equation} For the system to have a unique solution (determinant compatible), the determinant of the coefficients must vanish. \begin{equation} \left| \begin{array}{cc} H_{11}-WS_{11} & H_{12}-WS_{12}\\ H_{21}-WS_{21} & H_{22}-WS_{22} \end {array} \right|=0 \end{equation} The resolution of the determinant gives us the eigenvalues of $\varphi$, that is, the energies, W. From the energies, the variational coefficients $c_1$ and $c_2$.