How can I create matrices in general in LaTeX? As well as the one below?

Are there packages that are preferred over others?
How can I create matrices in general in LaTeX? As well as the one below?

Are there packages that are preferred over others?
Use amsmath: it defines 6 types of matrix environments: matrix (without any delimiter), pmatrix (delimiters: ( )), bmatrix ([ ]), Bmatrix ({ }), vmatrix (| |), Vmatrix (|| ||). Columns are centred.
Still better: with mathtools, an extension of amsmath, you have starred variants which accept an optional argument for the columns alignment ([l], [r] or [c], valid for all columns).
Here is a code for your image:
\[ \begin{pmatrix}x'\\y'\end{pmatrix}=
\begin{bmatrix}
\cos\theta & -\sin\theta\\
\sin\theta & \cos\theta
\end{bmatrix}
\begin{pmatrix}x \\y \end{pmatrix} \]
The use of \[ ... \] can be substituted by the equation environment \begin{equation} ... \end{equation}
amsmathpackage, and itspmatrixandbmatrixenvironments. – Torbjørn T. Dec 04 '16 at 20:39