# how to adjust space in matrix from the right and left side?

I made a matrix with some elements in, and now I want to ajust space of right and left side to the first(last) element in matrix, but HOW?

\begin{displaymath}
P=
\left[
\begin{matrix}
x & 0 & 0 \\
x & x & 0 \\
x & x & x \\
0 & x & x \\
0 & 0 & x \\
\end{matrix}

• Is this relative to other elements in the tikzpicture, or things outside the tikzpicture? Do you want to add or remove space? If you can make a minimal working example, that might be helpful in order to give you a good answer. – Torbjørn T. May 21 '17 at 21:15
• Welcome to TeX SX! Could you be more explicit? – Bernard May 21 '17 at 21:15
• matrix normally means the environment of that name from amsmath but you have tagged tikz-matrix do you intend to ask about that? – David Carlisle May 21 '17 at 21:15
• I added an example – Bonnie May 21 '17 at 21:27
• just get rid of the \left[..\right] and use bmatrix instead of matrix and better positioned brackets will be added. – David Carlisle May 21 '17 at 21:49

\documentclass{article}
$$P= \left[\; \begin{matrix} x & 0 & 0 \\ x & x & 0 \\ x & x & x \\ 0 & x & x \\ 0 & 0 & x \\ \end{matrix}\; \right]$$