How to center an equation in Latex?

How to center an equation in Latex? By default my equations are at left side. I’ve searched a lot but none worked. Codes like \begin{center}…\end{center} seem can’t be recognized.

This may be a little late for you, but this is what I usually do.
To align equations to the right

\begin{align*}
    \bm z^{[1]} = W^{[1]}x + b^{[1]} \\
    \bm a^{[1]} = g^{[1]}(\bm z^{[1]}) \\
\end{align*}

To align equations to the left, put an & before each line

\begin{align*}
        & \bm z^{[1]} = W^{[1]}x + b^{[1]} \\
        & \bm a^{[1]} = g^{[1]}(\bm z^{[1]}) \\
\end{align*}

If you want to numerate the equations (a number will appear after each equation), then delete the * in the begin and end clauses

\begin{align}
        & \bm z^{[1]} = W^{[1]}x + b^{[1]} \\
        & \bm a^{[1]} = g^{[1]}(\bm z^{[1]}) \\
\end{align}