[Tex/LaTex] Matrix within matrix with numbering

arraysmatrices

What is the best way to create the below matrix in LaTeX?

matix in matrix

I tried two ways

1)
using gather, pmatrix and vmatrix inside but cannot get the desired formatting

\begin{gather}
\begin{pmatrix} 
    \begin{vmatrix} x_{11} & x_{12} \\  x_{21} & x_{22}\\ \end{vmatrix}
 \\ y \\ z\\
\end{pmatrix}
\end{gather}

2)
I get the right format using two arrays but the numbering (gather) doesn't work

\begin{gather}
\[\left(
\begin{array}{cr}
    \left| \begin{array}{cr}
     x_{11} & x_{12} \\  x_{21} & x_{22} \end{array}\right| \\ y \\ z \\
\end{array}
\right)\]
\end{gather}

Best Answer

You shouldn't be using gather for a single equation. Anyway, the second example is wrong because you must not have \[...\] inside a math display.

The image shows too wide spaces around the fences; it was probably obtained with array.

I'll present three possibilities, in order of preference. Here I use three consecutive equation environment just because they're independent examples; for groups of consecutive equations, gather or align should obviously be used in a real document.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\begin{pmatrix}
\begin{vmatrix} x_{11} & x_{12} \\  x_{21} & x_{22} \end{vmatrix}
 \\ y \\ z
\end{pmatrix}
\end{equation}

\begin{equation}
\begin{pmatrix}
\;\begin{vmatrix} x_{11} & x_{12} \\  x_{21} & x_{22} \end{vmatrix}\;
 \\ y \\ z
\end{pmatrix}
\end{equation}

\begin{equation}
\left(
  \begin{array}{c}
  \left|\begin{array}{cc}
    x_{11} & x_{12} \\  x_{21} & x_{22}
  \end{array}\right|
  \\ y \\ z
  \end{array}
\right)
\end{equation}

\end{document}

enter image description here