6

So this is the code that I have so far:

\[
  Y =
  \begin{bmatrix}
    Y_{1}   \\
    Y_{2}   \\
    \vdots \\
    Y_{n}
  \end{bmatrix}
  =
  \begin{bmatrix}
    42 \\
    33 \\
    75 \\
    28 \\
    91 \\
    55
  \end{bmatrix}\quad
  X=
  \begin{bmatrix}
    1      & X_{11} & X_{12} & ... & & X_{1,p-1}\\
    1      & X_{21} & X_{22} & ... & & X_{2,p-1}\\
    \vdots & \vdots & \vdots &     & & \vdots\\
    1      & X_{n1} & X_{n2} & ... & & X_{n,p-1}\\
  \end{bmatrix}
  =
  \begin{bmatrix}
    1 & 7  & 33\\
    1 & 4  & 41\\
    1 & 16 & 7\\
    1 & 3  & 49\\
    1 & 21 & 5\\
    1 & 8  & 31
  \end{bmatrix}
\]

And I want to write out this equation:

\textbf{b}=$(X'X)^{-1}(X'Y)$

I would like to put a parentheses around X'X, but how would I do that? like in this format:

([x][x'])<-big parentheses around matricies
5

Not exactly sure what you're after, but the following might be sufficient to show you what you can do:

enter image description here

\documentclass{article}

\usepackage{amsmath}

\newcommand{\Xmatrix}{
  \begin{bmatrix}
    1 &  7 & 33 \\
    1 &  4 & 41 \\
    1 & 16 &  7 \\
    1 &  3 & 49 \\
    1 & 21 &  5 \\
    1 &  8 & 31
  \end{bmatrix}}
\newcommand{\Ymatrix}{
  \begin{bmatrix}
    42 \\ 33 \\ 75 \\ 28 \\ 91 \\ 55
  \end{bmatrix}}

\begin{document}

\[
  Y = \begin{bmatrix}
    Y_1 \\ Y_2 \\ \vdots \\ Y_n
  \end{bmatrix}
  = \Ymatrix
  \quad
  X = \begin{bmatrix}
      1    & X_{11} & X_{12} & \cdots & X_{1,p-1} \\
      1    & X_{21} & X_{22} & \cdots & X_{2,p-1} \\
    \vdots & \vdots & \vdots &        &  \vdots   \\
      1    & X_{n1} & X_{n2} & \cdots & X_{n,p-1} \\
  \end{bmatrix}
  = \Xmatrix
\]

\[
  \mathbf{b} = \bigl( X^T X \bigr)^{-1} \bigl( X^T Y \bigr)
\]

\[
  \mathbf{b} = \left( \Xmatrix^T \Xmatrix \right)^{-1} \left( \Xmatrix^T \Ymatrix \right)
\]

\[
  \mathbf{b} = \begin{pmatrix}
    \Xmatrix^T \Xmatrix
  \end{pmatrix}^{-1}
  \begin{pmatrix}
    \Xmatrix^T \Ymatrix
  \end{pmatrix}
\]

\end{document}

Large braces or brackets around objects can either be achieved using "\big operators", \left...\right pairs, or *matrix-like environments.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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