1

enter image description here

I tried using the cases to code this, but I only can put them in two separate lines, not along the same line.

2 Answers2

5

cases can be normally concatenated horizontally:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{equation}
  p_n =
  \begin{cases}
    x_n,  & \text{ if } x_n \ge 0 \\
    0,    & \text{ if } x_n < 0 
  \end{cases} \qquad \text{and} \qquad 
  m_n = 
  \begin{cases}
    -x_n,  & \text{ if } x_n \le 0 \\
    0,     & \text{ if } x_n > 0 
  \end{cases}
\end{equation}

\end{document}

enter image description here

AboAmmar
  • 46,352
  • 4
  • 58
  • 127
2

I'm not very keen to answer on question of type do-it-for-me ... but since AboAmmar was good soul :) and provide MWE, I will exploit his solution to show an alternative available with mathools package:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
    \begin{equation}
p_n =
\begin{cases*}
x_n,  & if $x_n \ge 0$  \\
0,    & if $x_n <   0$
\end{cases*}
\qquad \text{and} \qquad
m_n =
\begin{cases*}
-x_n,  & if     $x_n \le 0$ \\
0,     & if     $x_n >   0$
\end{cases*}
    \end{equation}
\end{document}

enter image description here

Zarko
  • 296,517