# 'Given that' in a matrix

I am trying to create the following equation where I have n given that y where y must be split among two lines. This is the code I have so far (which will give me the big braces).

\left\{
\begin{matrix}
...
\end{matrix}
\right\}


Any idea how I can fill the matrix to obtain the following please? Thanks

Not sure what you have in mind for the dots. Here, I show it with either a matrix or an aligned block.

Thanks to egreg for the \middle reminder.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\left\{ n\,\middle| \begin{matrix}2x & y\\3x & 2y\end{matrix}\right\}$
\left\{ n\,\middle| \begin{aligned} z &= 2x + y\\z &= 3x - 2y\end{aligned}\right\}
\end{document}


• @egreg I sure did, though I can't say that I am enamored of the spacing. – Steven B. Segletes Mar 28 '19 at 12:26

Use mathtools:

\documentclass{article}
\usepackage{mathtools}

\DeclarePairedDelimiterX{\Set}[1]{\lbrace}{\rbrace}{\activatebar #1}

\newcommand{\activatebar}{%
\begingroup\lccode~=| \lowercase{\endgroup\let~}\activebar
\mathcode|="8000
}
\newcommand{\activebar}{\nonscript\;\delimsize\vert\nonscript\;\mathopen{}}

\begin{document}

$\Set{n|n>0} \Set[\big]{n|n>0} \Set*{n|\begin{matrix} n>0 \\ n<42 \end{matrix}}$

\end{document}


Important note: don't use | for other purposes in the argument of \Set; it shouldn't be used anyway, preferring \lvert and \rvert for the absolute value. Or, of course, with macros based on mathtools, such as

\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
`