0

I'm trying to create this formula (the one with the matrices) for my essay in latex but I'm having a hard time finding the best way of going about it.

matrix formula

1
  • 2
    pmatrix env for the patrices and vectores, \dots, \vdots, \ddots for the dots.
    – daleif
    Commented May 9, 2022 at 12:27

1 Answer 1

4

The coding of this matrix product is quite straightforward, just take the time to write the four matrices that make up the formula with indexed variables.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
\begin{equation*}
  \begin{pmatrix}
    y_1 \\
    \vdots \\
    y_n
  \end{pmatrix}=
  \begin{pmatrix}
    1 & x_{12} & \ldots & x_{1k} \\
    \vdots & \vdots & \ddots & \vdots \\
    1 & x_{N2} & \ldots & x_{Nk}
  \end{pmatrix}
  \begin{pmatrix}
    \beta_1 \\
    \vdots \\
    \beta_k
  \end{pmatrix}
  +
  \begin{pmatrix}
    u_1 \\
    \vdots \\
    u_k
  \end{pmatrix}
\end{equation*}
% <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\end{document}
      

produit matriciel

7
  • Oops, the top right element in the second matrix should be x_{1k}. Commented May 9, 2022 at 18:06
  • @barbara beeton: It was a deliberate mistake to see if the participants in tex.stackechange had the sagacity attributed to them :-). I'm glad to see it's real. I will now be able to use the good advice I find on this site with confidence. Big thanks ! (I corrected the error)
    – gigiair
    Commented May 9, 2022 at 19:28
  • 1
    There are too many unnecessary yet distracting %. Commented May 9, 2022 at 19:46
  • @gigiair -- I may not be a good example for this purpose. Although quite a few participants here are long-time TeX users and package developers, and we try to be both helpful and truthful, we're not the "whole story". Just be careful, please. Commented May 9, 2022 at 20:53
  • @vtfs271232 -- While it's true that none of the % signs in this example are needed, it would have been helpful to give the reason -- spaces are ignored in math. The trick about using % signs is to learn where they are necessary or useful, and where they can be ignored. And that does take practice. Commented May 9, 2022 at 20:59

You must log in to answer this question.

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