# How can I improve displaying repetitive equations

I'm looking to improve my report quality by making equations more clear. As the equations I'm stating are repetitive a couple of times throughout the report I thought it would be better to use matrix notation.

Currently the equations look like this:

\begin{align}
dCA_{p,1} =  - &1 \cdot A - 2 \cdot B + 3 \cdot C \nonumber\\
+ &4 \cdot A \cdot B + 5 \cdot A^2 - 6 \cdot C ^2\label{eq:dCA_p_1_2}\\
dCA_{m,1} =  &8 \cdot A - 9 \cdot B + 5 \cdot C \nonumber\\
- &5 \cdot A \cdot B - 4 \cdot A^2 + 1 \cdot B^2\label{eq:dCA_m_1_2}\\
- &3 \cdot C ^2\nonumber\\
dCA_{l,1} =  &3 - 3 \cdot A - 2 \cdot B - 3 \cdot C  + 3 \cdot D\nonumber\\
+ &5 \cdot A\cdot B - 3 \cdot A\cdot D \label{eq:dCA_l_1_2}\\
- &1 \cdot B\cdot D - 2 \cdot C \cdot D + 3 \cdot B^2\nonumber\\
+ &2 \cdot C ^2 + 6 \cdot D^2\nonumber\\
\end{align}


One can clearly notice the repetitive parameters A , B , C and D. Therefore I tried the following approach:

$$\left( \begin{array}{c} dCA_{p,1}\\ dCA_{m,1}\\ dCA_{l,1} \end{array}\right) = \left(\begin{array}{cccccccccccccc} 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 \\ 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 \\ 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 \end{array}\right) \left(\begin{array}{c} A\\ B\\ C\\ D\\ A\cdot B\\ A\cdot C\\ A\cdot D\\ B\cdot C\\ B\cdot D\\ C\cdot D\\ A^2\\ B^2\\ C^2\\ D^2 \end{array}\right)$$


This output is however very wide and long. Already with single rounded numbers. Actual numbers would be a 4 digit number, for example: 2.314.

Is the last approach the way to go or are there other possibilities? Maybe there is a way to reduce the length by rewriting the squared signs in another way. I'm not sure how accomplish this.

Replacing the array with pmatrix gives a slightly slimmer expression, yet still very wide...

$$\left( \begin{array}{c} dCA_{p,1}\\ dCA_{m,1}\\ dCA_{l,1} \end{array}\right) = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 \\ 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 \\ 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 \end{pmatrix} \left(\begin{array}{c} A\\ B\\ C\\ D\\ A\cdot B\\ A\cdot C\\ A\cdot D\\ B\cdot C\\ B\cdot D\\ C\cdot D\\ A^2\\ B^2\\ C^2\\ D^2 \end{array}\right)$$


As proposed by Mico, as far as i understood:

$$\begin{pmatrix} dCA_{p,1}\\ dCA_{m,1}\\ dCA_{l,1} \pmatrix{pmatrix} = \begin{pmatrix} 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \end{pmatrix} \begin{pmatrix} A\\ B\\ C\\ D \end{pmatrix} + \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 \\ 1 & 2 & 3 & 4 & 5 & 6 \\ 1 & 2 & 3 & 4 & 5 & 6 \end{pmatrix} \begin{pmatrix} A\cdot B\\ A\cdot C\\ A\cdot D\\ B\cdot C\\ B\cdot D\\ C\cdot D \begin{pmatrix} + \begin{pmatrix} 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \end{pmatrix} \begin{pmatrix} A^2\\ B^2\\ C^2\\ D^2 \begin{pmatrix}$$

• Welcome to TeX.SE. – Mico Jul 20 '20 at 10:23
• One improvement you could make is to use begin{split} within the align block for the multi-line equations, instead of \nonumber. You might also try nicematrix to have better control over the width of your columns. – Davislor Jul 20 '20 at 10:48
• You coud use three inner-product expressions, one each in the linear, bi-linear, and quadratic terms, right? – Mico Jul 20 '20 at 10:57
• @Mico Nobody is stopping me from anything, might give that a go, did you mean the way as in the newest edit of the question? – Jasper Jul 20 '20 at 11:00
• @Jasper - Please see the answer I just posted. – Mico Jul 20 '20 at 11:08

I would like to suggest a variant of your idea to use matrix algebra to display the equations. However, instead of displaying a (3x14) matrix and a (14x1) column vector, one could display three smaller matrices of order (3x4), (3x6), and (3x4) and column vectors of length 4, 6, and 4, respectively, to capture the linear, bilinear, and quadratic terms in A, B, C, and D.

This setup should give you enough space to use "real" coefficients, not just signed integers.

Whatever else you end up doing, I'd recommend losing the \cdot terms.

(Aside: I provide no guarantee that I transcribed the coefficients correctly in the matrices shown below!)

\documentclass{article}
\usepackage{mathtools} % for 'pmatrix*' env.
\setcounter{MaxMatrixCols}{14}
\newcommand\vn[1]{\textit{#1}}
\begin{document}

$$\begin{split} \begin{pmatrix} d\vn{CA}_{p,1}\\ d\vn{CA}_{m,1}\\ d\vn{CA}_{l,1} \end{pmatrix} &= \begin{pmatrix*}[r] -1 & -2 & 3 & 0 \\ 8 & -9 & 5 & 0 \\ -3 & -2 & -3 & 3 \end{pmatrix*} \begin{pmatrix} A \\ B \\ C \\ D \end{pmatrix} \\ &\quad+ \begin{pmatrix*}[r] 4 & 0 & 0 & 0 & 0 & 0 \\ -5 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & -1 & -2 \end{pmatrix*} \begin{pmatrix} A B \\ A C \\ A D \\ B C \\ B D \\ C D \end{pmatrix} \\ &\quad+ \begin{pmatrix*}[r] 5 & 0 & -6 & 0 \\ 0 & 0 & -3 & 0 \\ 0 & 0 & 2 & 6 \end{pmatrix*} \begin{pmatrix} A^2 \\ B^2 \\ C^2 \\ D^2 \end{pmatrix} \end{split}$$
\end{document}

• Yes, it's never going to look elegant anyway with the size of matrices I'm working with. Therefore this is probably the easiest way to note this down, at least i would find this much more appealing to read as compared to the way @egreg noted it. Eventhough that also looks like a big improvement already. Thanks, will try some things out and see if it works together – Jasper Jul 20 '20 at 11:13

The actual matrix would be too sparse to be useful in reading. I'd exploit the natural division of the terms into three categories: linear, product of two distinct variables, squares.

Typesetting vertically the fifteen-row matrix is too space consuming.

\documentclass{article}
\usepackage{amsmath}

\setcounter{MaxMatrixCols}{15}

\begin{document}

\begin{align}
dCA_{p,1} &= - A - 2 B + 3 C \notag \\
&\qquad + 4 A B \notag \\
&\qquad + 5 A^2 - 6 C ^2 \label{eq:dCA_p_1_2}
\\[1ex]
dCA_{m,1} &= 8 A - 9 B + 5 C \notag \\
&\qquad - 5 A B \notag \\
&\qquad - 4 A^2 + 1 B^2 - 3 C ^2 \label{eq:dCA_m_1_2}
\\[1ex]
dCA_{l,1} &=  3 - 3 A - 2 B - 3 C  + 3 D \notag \\
&\qquad + 5 AB - 3 AD - BD - 2 C D \notag \\
&\qquad + 3 B^2 + 2 C^2 + 6 D^2 \label{eq:dCA_l_1_2}
\end{align}

$$\begin{pmatrix} dCA_{p,1}\\ dCA_{m,1}\\ dCA_{l,1} \end{pmatrix} = MT$$
where
\begin{align*}
M &= \begin{pmatrix}
% 0    A    B    C    D   AB   AC   AD   BC   BD   CD   A2   B2   C2   D2
0 & -1 & -2 &  3 &  0 &  4 &  0 &  0 &  0 &  0 &  0 &  5 &  0 &  0 &  0 \\
0 &  8 & -9 &  5 &  0 & -5 &  0 &  0 &  0 &  0 &  0 & -4 &  1 & -3 &  0 \\
3 & -3 & -2 & -3 &  3 &  5 &  0 & -3 &  0 & -1 & -2 &  0 &  3 &  2 &  6
\end{pmatrix}
\\
T &=