Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to show that matrix A (m rows, n columns) times matrix B(n rows, k columns), results as matrix C ( m rows, k columns).

enter image description here

I wonder what's the easier way to write it?

there are several posts here, I found Block matrix equation with dimensioning and Equation with Large Matrix Dimension a bit too complex, while Matrix decomposition dimensions diagram put the dimensions at the bottom of the matrix, while I hope this can be displayed on the left and top.

share|improve this question
    
@Brian yes. I only know how to put subtext on top-right, top-bottom, top-left, bottom-left corner, but don't know how to put things on top, left, right or bottom. –  athos Aug 5 at 4:00
1  
Why do you want create confusions when things can be simple and neat? –  subham soni Aug 5 at 6:02
1  
I have some experience with linear algebra teaching that, other than showing rectangles with rows and vectors inside them, nothing is illustrative/explanatory. They just create more confusion or state the obvious; People know how to multiply already know it, people who don't know it won't get it with notations. –  percusse Aug 5 at 10:42

5 Answers 5

up vote 14 down vote accepted

I would suggest writing something more traditional and clear:

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
  \underset{(m \times n)}{A} \times \underset{(n \times k)}{B} =
    \underset{(m \times k)}{C}
\]
\end{document}
share|improve this answer
    
after comparison, I agree, this notation is much better. Thanks! –  athos Aug 5 at 6:27
7  
I would suggest not using \times between A and B, as the symbol is never used in this context. –  egreg Aug 5 at 9:32

You could use the following code -- note the use of positive thinspace (\,) and negative thinspace (\!) to finetune the position of the side-set and supra-set items.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$ {}^m\!\overset{\,n}{A} \, {}^n\!\overset{\,k}{B} = {}^m  \overset{\,k}{C} $
\end{document}

enter image description here

share|improve this answer

A variation of Mico's solution, that's less obtrusive.

The height of the two small superscripts can be changed with an optional argument, in case of need:

\rowcol[<height>]{<matrix>}{<rows>}{<columns>}

\documentclass{article}

\newcommand{\rowcol}[4][2ex]{%
  \raisebox{#1}{\vtop{
    \tiny
    \ialign{%
      &##\cr
      &\rlap{$\,#4$}\cr
      \noalign{\nointerlineskip}
      $#3\!$\cr
    }
  }}
  #2
}

\begin{document}
\[
\rowcol{A}{m}{n}\cdot\rowcol{B}{n}{k}=\rowcol{C}{m}{k}
\]
\end{document}

enter image description here

share|improve this answer

For a subscript to be put on the top of a given symbol one uses \overset{}{}, where the first blank is to be replaced with the intended subscript and the second blank is to be replaced with the given symbol.

For subscripts to be put on the left or right of a given symbol you may refer to the question here: Left and right subscript

Hope these helpful.

share|improve this answer
    
Sorry the description is not clear. I just updated the question with a picture. –  athos Aug 5 at 3:51
    
Never mind. So do you mean you wish to know the codes for displaying what the picture shows? If so then the revised answer works. –  Kurt Aug 5 at 4:00

Another suggestion:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
  A_{m \times n} B_{n \times k} = C_{m \times k}
\]
\end{document}

enter image description here

EDIT: Or you can simply declare the matrices

enter image description here

and then AB = C. This notation is used, for example, in Golub, Van Loan, "Matrix Computation", 3rd Ed. Johns Hopkins, 1996.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.