Well, you've set up an array with four columns left-aligned \begin{array}{llll}
- that's what your four l
s do.
In order to align the 2s, I suggest a hack
\documentclass[12pt]{article}
\pagestyle{plain}
\usepackage[margin=1.8cm]{geometry}
\geometry{a4paper}
\usepackage[parfill]{parskip}
\usepackage{amsmath}
\usepackage{amssymb}
\newlength{\minuslength}
\settowidth{\minuslength}{$-$}
\begin{document}
\begin{equation*}
\left(
\begin{array}{llll}
1 & \hspace{\minuslength}0 & 0 & 0 \\
0 & \hspace{\minuslength}2 & 2i & 0 \\
0 & -2i & 2 & 0 \\
0 & \hspace{\minuslength}0 & 0 & 1
\end{array}
\right)
\end{equation*}
\end{document}

What I've done here is set up a length called \minuslength
:
\newlength{\minuslength}
I then give this length the width of a minus sign:
\settowidth{\minuslength}{$-$}
I can then insert a space the width of a minus sign \settowidth{\minuslength}{$-$}
before each of the elements.
This is a bit inelegant though. There might be nicer ways of doing this, but are you sure centring wouldn't be preferable.
In order for the columns to be centred, you must specify that you want four centred columns \begin{array}{cccc}
\begin{equation*}
\left(
\begin{array}{cccc}
1 & 0 & 0 & 0 \\
0 & 2 & 2i & 0 \\
0 & -2i & 2 & 0 \\
0 & 0 & 0 & 1
\end{array}
\right)
\end{equation*}

But in all honesty, it would be easier to just use a pmatrix
(p
for parentheses, you can use bmatrix
for matrices with square brackets ([]
) Bmatrix
for matrices with braces ({}
) and there are others):
\begin{equation*}
\begin{pmatrix}
1 & 0 & 0 & 0 \\
0 & 2 & 2i & 0 \\
0 & -2i & 2 & 0 \\
0 & 0 & 0 & 1
\end{pmatrix}
\end{equation*}

array
to typeset matrices is of course possible, but introduces gratuitous whitespace when enclosed in parentheses. Therefore it is preferred to use the designatedmatrix
environment and its descendantspmatrix
(parentheses),bmatrix
(brackets),vmatrix
(vertical lines), etc.