[Tex/LaTex] Aligning using flushleft and flushright

alignhorizontal alignment

I am trying to create one column to the left side by side with another column to the right. The column to the left is labeled "Examples of like terms:" and the column to the right is labeled "Examples of unlike terms:"

Here is my work so far:

\documentclass{article}
\usepackage{gensymb}
\usepackage{amsfonts}
\usepackage{amsmath}
\begin{document}
\title{Algebra}
\maketitle

\section{Like Terms} 



\begin{flushleft}                           
\textbf{Examples of like terms:} \\
$3x$ and $5x$ \\
$4y^2$ and $9y^2$ \\
$7xy$ and $3xy$ \\
$6$ and $15$ 
\end{flushleft} 

\begin{flushright}                                      
\textbf{Examples of unlike terms:} \\ 
$2x$ and $8y$ \\
$4t^2$ and $4t^3$ \\
$x^2y$ and $xy^2$ \\
$12$ and $12x$ 
\end{flushright} 


\end{document} 

Best Answer

Use the minipage environment:

\documentclass{article}
\begin{document}
  \title{Algebra}
  \maketitle
  \begin{minipage}{.45\linewidth}
    \begin{flushleft}
      \textbf{Examples of like terms:} \\
      $3x$ and $5x$ \\
      $4y^2$ and $9y^2$ \\
      $7xy$ and $3xy$ \\
      $6$ and $15$ 
    \end{flushleft}
  \end{minipage}
  \hfill
  \begin{minipage}{.45\linewidth}
    \begin{flushright}
      \textbf{Examples of unlike terms:} \\ 
      $2x$ and $8y$ \\
      $4t^2$ and $4t^3$ \\
      $x^2y$ and $xy^2$ \\
      $12$ and $12x$ 
    \end{flushright} 
  \end{minipage}
\end{document}

enter image description here