In mathematics, tensors are geometric objects that describe linear relations between vectors, scalars, and other tensors. They are commonly used in physics and engineering to represent physical properties such as mechanical stress, electric field, flux, and moments of inertia.
The tensor product is a specialized operation that combines tensors by generalizing the outer product of vectors. The resulting tensor product space describes systems with multiple interacting subsystems, which is critical for applications like quantum computing and NMR spectroscopy.
This guide explains the LaTeX markup and code required to properly format tensor products in your mathematical expressions. We‘ll cover the basics as well as more advanced usages.
Overview of Tensors
Tensors can be represented as multidimensional arrays with specific transformation rules. The order (or rank) of a tensor refers to the number of indices needed to identify an element.
For example:
- A scalar is represented as a 0th order tensor and has only a magnitude.
- A vector is a 1st order tensor with one index e.g. V_x.
- A matrix is a 2nd order tensor with two indices e.g. T_xy.
The coordinates of each index span a specific vector space. The dimension of these spaces determines the shape of the tensor.
When vectors and matrices are combined in specific ways, they generate higher order tensors. The tensor product is one such combining operation.
Basics of the Tensor Product
The tensor product essentially joins two tensors together into a higher order tensor. If A is an m x n matrix and B is a p x q matrix, then the tensor product A ⊗ B is the mp x nq block matrix:
A ⊗ B = \begin{bmatrix}
a_{11}B & ⋯ & a_{1n}B \\
⋮ & ⋱ & ⋮ \\
a_{m1}B & ⋯ & a_{mn}B
\end{bmatrix}
The result contains m x n blocks, with each block being B scaled by the corresponding element of A. This shows how the tensor product couples the vector spaces of the original tensors.
To write a basic tensor product in LaTeX:
\documentclass{article}
\begin{document}
$$A \otimes B$$
\end{document}
Which renders as:
Note the ⊗ symbol denoting the tensor product operation.
LaTeX interprets otimes
as the tensor product symbol by default. So you don‘t need any special packages to generate this markup.
Typography and Spacing
Pay close attention to spacing when combining a tensor product with other symbols:
- Usethin spaces
\
to tightly integrate words/symbols - Useregularspaces
~
for slight separation - Usequadspaces
\quad
for large gaps
For example:
$$A~\otimes~ B \quad vs \quad A\otimes B$$
Renders with tighter and wider spacing:
Proper spacing improves readability substantially when dealing with complex mathematical expressions.
Multi-Tensor Products
We can perform tensor products over three or more tensors as well.
For example, the tri-tensor product:
\mathbf{A} ⊗ \mathbf{B} ⊗ \mathbf{C}
Represents a system characterized by each of those tensors. By convention, we use bold fonts to identify tensors involved in a multi-product.
Explicitly writing out large tensor products gets complex fast. We can simplify notation for quad- or higher-order products using an ellipsis (...).
\mathbf{A} ⊗ \mathbf{B} ⊗ \mathbf{C} ⊗...⊗\mathbf{Z}
Formatting Tensor Indices
Tensors have indices associated with each dimension. We can format these as subscripts or superscripts:
A^\mu_{~\nu} ⊗ B^{\alpha\beta}
Renders as:
Note that Greek letters \mu, \nu, \alpha, \beta
are conventionally used as tensor indices.
Indices need to align correctly across a tensor product for clear notation:
A^\mu_{~\nu} ⊗ B_\mu^{~\nu} \\
% Incorrect alignment
A^\mu_{~\nu} ⊗ B_\nu^{~\mu}
% Correct alignment
This ensures that joined dimensions match across the resulting tensor. Misaligned indices imply incorrect dimensional coupling that violates the tensor transformation rules.
Formatting Subscripts and Superscripts
We use underscores _{ }
and carets ^{ }
to format subscripts and superscripts in LaTeX math mode.
For example, a 3×3 transformation matrix T with row index i and column index j:
T = [T^i_{~j}]
Some tips when working with indices:
- Subscripts typically appear beforesuperscripts
- Use non-breaking spaces
~
between indices to prevent line breaks - Align same indices appropriately to show dimensionality
Scaling Tensors
We can multiply tensors by scalars for rescaling purposes. Make sure the scalar multiplier precedes the tensor properly:
5(A⊗B) % Wrong
(5)(A⊗B) % Also wrong
5(A⊗B) % Correct
The lack of spacing in the first two examples will generate compilation errors.
More complex scaling examples:
(xA^μ_{~\nu} + yB^\nu_{~\mu}) ⊗ (uC + vD^{\mu\nu})
Note how the entire left tensor is scaled as a grouped unit before the product.
Applying Functions to Tensors
Tensors can be passed as arguments to functions as well:
\exp(\mathbf{A}⊗\mathbf{B}) \\
\sin(A⊗B⊗C)
This represents the exponential and sine of those tensor products respectively.
Make sure functions are applied to entire products grouped together with parentheses.
Matrix Representation
We can explicitly represent a tensor product as a block matrix to show elements.
For example, 2×2 matrices A and B:
A = \begin{bmatrix}
a_{11} & a_{12}\\
a_{21} & a_{22}
\end{bmatrix}
B = \begin{bmatrix}
b_{11} & b_{12}\\
b_{21} & b_{22}
\end{bmatrix}
Their 2×4 tensor product:
A⊗B = \begin{bmatrix}
a_{11}B & a_{12}B \\
a_{21}B & a_{22}B
\end{bmatrix}
= \begin{bmatrix}
a_{11}b_{11} & a_{11}b_{12} & a_{12}b_{11} & a_{12}b_{12} \\
a_{11}b_{21} & a_{11}b_{22} & a_{12}b_{21} & a_{12}b_{22} \\
a_{21}b_{11} & a_{21}b_{12} & a_{22}b_{11} & a_{22}b_{12} \\
a_{21}b_{21} & a_{21}b_{22} & a_{22}b_{21} & a_{22}b_{22}
\end{bmatrix}
Observe how rows scale B using elements from A, coupling dimensions per the tensor product definition.
While cumbersome for small matrices, this representation clearly shows how elements interact in the result.
Kronecker Delta
The Kronecker delta δ_{ij} is a function that equals 1 when indices match or 0 otherwise.
It‘s often used in tensor mathematics much like the identity matrix:
δ^{\mu}_{~\nu} ⊗ A^\nu_{~\alpha} ⊗ B_\mu^{~\beta}
To format correctly in LaTeX:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\delta^\mu_{~\nu}$
\end{document}
Note that we import the amsmath
package for the \usepackage
macro. This gives access to more math functions.
Higher Dimension Tensors
Tensors can have more than two dimensions as well. This extends the matrix block representation.
For example, consider a rank-3 tensor D operating on vectors v and w:
D dimensions: 2 x 3 x 4
v dimensions: 3 x 1
w dimensions: 4 x 1
Their tensor contraction ⨂
:
D ⨂ v ⨂ w
= ∑ D^{ijk}v_jw_k
= ∑∑∑ D^{ijk}v_jw_k
Where the repeated indices j and k imply summation in the Einstein notation.
Written explicitly with block matrices:
D = \begin{bmatrix}
D^{111} & D^{112} & D^{113} & D^{114} \\
D^{121} & D^{122} & D^{123} & D^{124} \\
\vdots & \vdots & \vdots & \vdots \\
D^{211} & D^{212} & D^{213} & D^{214} \\
D^{221} & D^{222} & D^{223} & D^{224}
\end{bmatrix}
v = \begin{bmatrix}
v_1\\v_2\\v_3
\end{bmatrix}
w = \begin{bmatrix}
w_1 \\ w_2 \\ w_3 \\ w_4
\end{bmatrix}
Where rows represent the first index, columns the second index, and matrix slices the third index of D. Applying tensor contraction sequentially sums over the appropriate dimensions.
Stacked Tensor Products
We can also stack multiple tensor product terms using a vertical brace { }
:
A^{μν} ⊗ B_{μν} ⊗ \begin{Bmatrix}
C \\ D \\ E
\end{Bmatrix}
Renders as:
Think of the right brace as appending additional tensors to the main horizontal product. This condenses notation when dealing with many terms.
Bold Tensor Notation
A bold variable represents a geometric object like a vector or matrix. By extension, we denote tensors with bold as well.
For example:
\mathbf{A} ⊗ \mathbf{B} ⊗ \mathbf{C}
To generate bold symbols in LaTeX, use:
\boldsymbol{A} % for bold vector A
\mathbf{B} % bold B matrix
So rewriting:
\boldsymbol{\alpha} ⊗ \mathbf{B}^{\beta\gamma} ⊗ \boldsymbol{\Phi}
Take care to avoid bolding indices, only use them on the head variable or main symbol.
Vector and Matrix Spaces
We frequently operate over specific vector spaces like the real coordinate space $\mathbb{R}^n$ or complex space $\mathbb{C}^n$.
Denote the appropriate number space as a superscript for each index:
A^{\mathbb{R}^m} ⊗ B^{\mathbb{C}^n}
Alternatively, define namespaced variables:
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
A^{\R^m} ⊗ B^{\C^n}
Where \newcommand
lets us reuse the real ($\R$) and complex space ($\C$) identifiers.
Sizing and Scaling
The \otimes
symbol has a fixed size that may not aesthetically match expressions in some cases.
To increase the size, use \bigotimes
:
A \otimes B \text{ (small)}
A \bigotimes B \text{ (large)}
Renders as:
For full control over math symbol sizes, refer to LaTeX font size adjustments.
Edge Cases and Common Errors
When manipulating complex tensor expressions, you may encounter compilation issues or unintended outputs.
Some examples include:
1. Incorrect spacing
A\otimes B % wrong, no space
Fix by adding spaces around operators:
A~\otimes~B % with tight spaces
2. Bold math errors
\mathbf{5x} % forbidden
Variables, symbols, or text may fail to bold properly in math mode. Simply remove inappropriate emboldening.
3. Floating tensors
Random matrix blocks floating on new lines:
A = \begin{bmatrix}
a & b\\
%% floating block matrix
\begin{matrix}
c & d
\end{matrix}
\end{bmatrix}
Fix by ensuring matrices and alignments are structured properly. Refer to LaTeX matrices for details.
4. Infinite glue errors
Long expressions may fail to compile with Incomplete \iffalse
or Infinite glue
errors. This occurs when alignment rules conflict. Inspect each row and double check symbol usage.
Conclusion
This guide summarized the basics of representing tensor products in LaTeX documents, which are critical for showcasing mathematical expressions with multiple indices.
The general notation follows straightforwardly once we understand how to format subscripts and superscripts properly. Ensure matching indices align across tensors joined by a product.
We also explored notation variations with stacking and arrays as well as common errors and fixes. Employ best practices with spacing and structure when manipulating complex, multi-line latex.
With these tensor product building blocks, we can render intricate mathematical work in physics, engineering, and quantitative research fields effectively.