# Errors in matrix equation?

I'm getting errors in a matrix equation. When I compile it looks fine, but I'd like to fix them so I don't have to press return for every error at compile time. The code for the equation is:

\begin{equation*}

\begin{bmatrix}
U(1,t)  & \cdots & U(n,t) \\
\vdots & \ddots & \vdots \\
O_{n1} & \cdots & O_{nn}
\end{bmatrix}
\times
\begin{bmatrix}
W(1,1)  & \cdots & W(1,n) \\
\vdots & \ddots & \vdots \\
W(n,1) & \cdots & W(n,n)
\end{bmatrix}
=
\begin{bmatrix}
D(1,t)  & \cdots & D(n,t) \\
\vdots & \ddots & \vdots \\
I_{n1} & \cdots & I_{nn}
\end{bmatrix}

\end{equation*}


The errors I'm getting are related to missing \$'s inserted.

-

If you remove the empty lines after \begin{equation*} and before \end{equation*} the error messages disappear.

-

I do not get any message with this one:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$\begin{bmatrix} U(1,t) & \cdots & U(n,t) \\ \vdots & \ddots & \vdots \\ O_{n1} & \cdots & O_{nn} \end{bmatrix} \times \begin{bmatrix} W(1,1) & \cdots & W(1,n) \\ \vdots & \ddots & \vdots \\ W(n,1) & \cdots & W(n,n) \end{bmatrix} = \begin{bmatrix} D(1,t) & \cdots & D(n,t) \\ \vdots & \ddots & \vdots \\ I_{n1} & \cdots & I_{nn} \end{bmatrix}$

\end{document}

-