# How to typeset this matrix equation using simple LaTeX tools

Here is the output I need:

The closest I could get is this:

\begin{equation*}
\begin{bmatrix}
& \\
v & \\
& \\
\end{bmatrix}
\begin{bmatrix}
w &  \\
\end{bmatrix}
\end{equation*}


Which outputs this:

But you can see there are obvious differences that I need:

1. v and w which are center-aligned inside the brackets.
2. The first matrix is a column matrix, and the second one is a row matrix and is located on the upper right side of the first matrix.

By "simple LaTeX tools" I mean preferably not using any special package, as I need the code in a Jupyter Notebook.

For your information, I also used MathPix, but it couldn't recognize the details I wanted.

• Welcome to TeX.SE. A theme I notice in the answers is that they've deleted your &. This was causing your left-alignment and wasn't really necessary to begin with. Nov 14 '20 at 17:56
• @Teepeemm Hello! Thank you for the tip. Yes, that solves the left-alignment problem. But shifting the second matrix upwards would still be a problem, and I could solve it with the help of the accepted answer. Nov 14 '20 at 18:23
• The simplest solution is \begin{bmatrix}\\v\\\\\end{bmatrix}^{\begin{bmatrix}w\end{bmatrix}} - this also works perfectly in MathJax, which is how Jupyter notebooks typeset LaTeX. Nov 14 '20 at 21:15

Nest the second bmatrix as the first element of a matrix environment and add to the latter two empty rows:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation*}
\begin{bmatrix}
\\
\; v\; \\
\\
\end{bmatrix}\!\!
\begin{matrix}
\begin{bmatrix}
\; w\; \\
\end{bmatrix}
\\{}\\ {}
\end{matrix}
\end{equation*}

\end{document}


Let TeX do the computations.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation*}
A=
\vcenter{\hbox{\valign{\hbox{$#$}\vfil\cr
}}}
\end{equation*}

\end{document}


Perhaps nesting array-environments and \vphantom in some places does the trick—but I assume there are much better solutions.

\documentclass{article}
\usepackage{array}

\begin{document}
$A=\left[% \begin{array}{c}% {\vphantom{\left[\begin{array}{c}w\end{array}\right]}}\\ {v}\\ {\vphantom{\left[\begin{array}{c}w\end{array}\right]}}\\ \end{array}% \right]\mathclose{}\ % \kern-\arraycolsep \begingroup % Adjust \arraycolsep to regulate the horizontal gaps between "[" and "w" and "]" \arraycolsep=1\arraycolsep\relax \kern-\arraycolsep \begin{array}{c}% {\mathopen{}\left[\begin{array}{c}w\end{array}\right]}\\ {\vphantom{v}}\\ {\vphantom{\left[\begin{array}{c}w\end{array}\right]}}\\ \end{array}\kern-\arraycolsep\endgroup=A$
\end{document}