[Tex/LaTex] Error-Undefined control sequence

errors

I occurred a problem recently, but, I donot know how to solve it?

Error:

Undefined control sequence.
l.26 $$\eqalignno
                 {P^{-1}&=P_{1}^{-1}+P_{2}^{-1}\cr P^{-1}\mathhat{x}&=P_{1}^...

My codes:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
 $$\eqalignno{P^{-1}&=P_{1}^{-1}+P_{2}^{-1}\cr P^{-1}\mathhat{x}&=P_{1}^{-1}\mathhat{x}_{1}+P_{2}^{-1}\mathhat{x}_{2}.&\hbox{(7)}}$$
\end{document}

Best Answer

Is this you want?

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
 \begin{align}
 \begin{aligned}
 P^{-1}           &=P_{1}^{-1}+P_{2}^{-1}\\
 P^{-1}\hat{x}&=P_{1}^{-1}\hat{x}_{1}+P_{2}^{-1}\hat{x}_{2}%.(7)
 \end{aligned}
 \end{align}
\end{document}

enter image description here

Actually, I should admit that I don't understand your code (\eqalignno and \mathhat). And in latex, don't use $$.