I'm a little confused because det(D) = 0 which suggests it's a singular matrix contradicting the question
Good! That means you are thinking. Let's take a look at some real idempotent matrices.
Let
[math]D = \left ( \begin{matrix} a & b \\ c & d \end{matrix} \right )[/math]
Then
[math]D^2 = \left ( \begin{matrix} a^2 + bc & ab + bd \\ ac + cd & bc + d^2 \end{matrix} \right ) = \left ( \begin{matrix} a & b \\ c & d \end{matrix} \right )[/math]
So we need to solve the system of equations
[math]\begin{cases} a = a^2 + bc \\ b = ab + bd \\ c = ac + cd \\ d = bc + d^2 \end{cases}[/math]
There are many ways to play with these, I'll let you go ahead and solve some if you like.
Let's take
[math]D = \left ( \begin{matrix} 1 & 0 \\ 1 & 0 \end{matrix} \right )[/math]This is idempotent, as you can check. It also has a determinant of 0.
Another. [math]D = \left ( \begin{matrix} 0 & 0 \\ 1 & 1 \end{matrix} \right )[/math]. Again, det(D) = 0.
But is this all that there is? Notice that [math]\left ( \begin{matrix} 1 & 0 \\ 0 & 1 \end{matrix} \right )[/math] is also idempotent and has determinant 1. Are there any other possibilities?
Here's a brief rundown of the result. The only way we can have an invertible idempotent matrix is for the main diagonal to be all 1s. If you work with it you will find that the only idempotent invertible matrices are the n x n identities. So there are idempotent matrices with a non-zero determinant but they are only the identities. (You can see this physically. Any idempotent matrix is a projection matrix. When we project a vector onto a surface we lose information (the "height" in the space perpendicular to the space you are projecting onto) so you can't "undo" it, ie. it has no inverse, ie. it has determinant 0.) There are a number of holes in my argument. Feel free to plug those holes... it will be a good exercise.
-Dan