3

I want my matrix to look like the one attached. I want my sum signs to be big and be in a matrix environment. Right now I am using the align environment and I am not quite sure how I can put brackets on it. Many thanks for the help!

\begin{align*}
\sum_{i=1}^{8}x_i^2 \qquad \sum_{i=1}^{8}x_i \sin(x_i)\\
\sum_{i=1}^{8}x_i \sin(x_i) \qquad \sum_{i=1}^{8} \sin^2(x_i) \\
\end{align*}

Many thanks for the helpenter image description here

1
  • 2
    Why don't you simply use the pmatrix environment?
    – Bernard
    May 8, 2021 at 14:02

2 Answers 2

4

You could use pmatrix environments inside a simple display math environment. Then you can make the sum symbols bigger by placing \displaystyle in front of them.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\begin{pmatrix}
    \displaystyle \sum_{i=1}^8 x_i^2 & \displaystyle \sum_{i=1}^8 x_i \sin(x_i) \\
    \displaystyle \sum_{i=1}^8 x_i \sin(x_i) & \displaystyle \sum_{i=1}^8 \sin^2(x_i)
\end{pmatrix} \cdot \begin{pmatrix}
    a \\ b
\end{pmatrix} = \begin{pmatrix}
    \displaystyle \sum_{i=1}^8 y_ix_i \\
    \displaystyle \sum_{i=1}^8 y_i \sin(x_i)
\end{pmatrix}
\]
\end{document}
1
  • Thanks so much! I was pretty sure there had to be a simple solution to this issue :) May 8, 2021 at 15:49
5

Here are two variations on @Vincent's answer which (a) use pmatrix* environments to left-align the cell contents and (b) use \addlinespace directives (provided by the booktabs package) to increase the separation between the rows of the matrix and the vector.

The first variation uses \displaystyle for each cell, and the second uses the default math style, viz., \textstyle. Speaking for myself, I don't see a good use case for \displaystyle for the equation at hand.

enter image description here

\documentclass{article}
\usepackage{mathtools} % for 'pmatrix*' env.
\usepackage{booktabs}  % for '\addlinespace' macro
\newcommand\mystrut{\vphantom{\sum_{i=1}^8}} % vertical spacers

\begin{document}
\[
\begin{pmatrix*}[l]
    \displaystyle \sum_{i=1}^8 x_i^2 & 
    \displaystyle \sum_{i=1}^8 x_i \sin(x_i) \\ \addlinespace
    \displaystyle \sum_{i=1}^8 x_i \sin(x_i) & 
    \displaystyle \sum_{i=1}^8 \sin^2(x_i)
\end{pmatrix*} 
\begin{pmatrix}
    a \\[1ex] b
\end{pmatrix} = 
\begin{pmatrix*}[l]
    \displaystyle \sum_{i=1}^8 y_ix_i \\  \addlinespace
    \displaystyle \sum_{i=1}^8 y_i \sin(x_i)
\end{pmatrix*}
\]


\[
\begin{pmatrix*}[l]
    \sum_{i=1}^8 x_i^2 & 
    \sum_{i=1}^8 x_i \sin(x_i) \\ \addlinespace
    \sum_{i=1}^8 x_i \sin(x_i) & 
    \sum_{i=1}^8 \sin^2(x_i)
\end{pmatrix*} 
\begin{pmatrix}
    a\mystrut \\ \addlinespace b\mystrut
\end{pmatrix} = 
\begin{pmatrix*}[l]
    \sum_{i=1}^8 y_ix_i \\  \addlinespace
    \sum_{i=1}^8 y_i \sin(x_i)
\end{pmatrix*}
\]

\end{document}
2
  • Thank you so much as well! Do you know by any chance what's the simplest methode to increase or decrease the space between the COLUMNS in the upper example with the displaystyle? Have a great day and thanks again! May 8, 2021 at 15:52
  • @GiovanniGorza - The amount of intercolumn whitespace in the amsmath/mathtools matrix-like environments is given 2\arraycolsep. The default value of \arraycolsep for most (all?!) document classes is 5pt. One may change \arraycolsep via \setlength and \addtolength statements. E.g., \addtolength\arraycolsep{10pt} or \setlength\arraycolsep{7pt}.
    – Mico
    May 8, 2021 at 16:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .