# Aligning a system of equations

I am trying to align three equations in two lines. How can I do it using \begin{align*}?

I want it to look like this:

But mine looks like this:

My code:

\begin{align*}
A^2 &= A, B^2 &= C, C^2 &= B,\\
AB &= B, AC &= C, BC &=A,
\end{align*}

• you need to indicate a column break after each comma, and add space there as well. – barbara beeton Aug 17 '16 at 14:35
• In short: n alignment groups require 2n - 1 ampersands. – Bernard Aug 17 '16 at 16:25

Quick fix:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
A^2 &= A, & B^2 &= C, & C^2 &= B,\\
AB &= B, & AC &= C, & BC &= A,
\end{align*}
\end{document}

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\begin{alignat}{4} A^2 &= A, & \quad & B^2 &= C, &\quad& C^2 &= B,\\AB &= B,&& AC &= C,&& BC &= A, \end{alignat}

\end{document}

• Is there a way to do it without "alignat"? – user19405892 Aug 17 '16 at 14:27
• @user19405892 there is also alignedat inside equation* or just array or a table or minipages. If you have some restrictions, you should tell us before and explain why! – LaRiFaRi Aug 17 '16 at 14:28