An environment is opened by \begin{name} and closed by \end{name}. The matrix family lays out rows and columns: & separates columns, \\ ends a row, and the name picks the brackets — pmatrix (round), bmatrix (square), vmatrix (bars), Bmatrix (braces), matrix (none).
Step 12 of 17 of the LaTeX tutorial. The formula of the step, \begin{pmatrix} a & b \\ c & d \end{pmatrix} \quad \begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad - bc, opens in a live playground you can edit.
Write a LaTeX or mhchem formula and see it drawn as you type, save it as an SVG that opens again, learn the notation step by step, and practise it with graded exercises. The tool needs JavaScript, because the formulas are drawn in your browser.