Suppose a random variable $D \sim N(0,1)$.
Define $U= 1 ,\text{if } D \ge 0$
and $U=0$ if $D<0$.
Find the correlation between $|D|$ and $U$.
I am really confused with the conditioning business here.
First , I find cov$(|D|,U)=E(|D|U)-E(|D|)E(U)$.
Now, we know , $E(U)=\frac{1}{2}$ and,
$E(|D|)=\sqrt{\frac{2}{\pi}}$
We have $E(|D|U)=E(DU|D>0)P(D>0)+0=E(D|D>0)P(D>0)=\frac{1}{2}.E(D|D>0)$
Now, $E(D|D>0)=\int_{0}^{\infty} \frac{1}{\sqrt{2 \pi}} D. e^{-\frac{D^2}{2}} dD=\frac{1}{2}$
So, I get the correlation coefficient as $\frac{1}{2}-\frac{1}{\sqrt{2 \pi}}$?
Is this approach correct or am I missing something?
The approach is good, but you make a couple of errors. Since $U=1_{D>0}$, I think it is better to write
$$E(|D|U) = E(D1_{D>0}) = \int_0^\infty x \frac{e^{-x^2/2}}{\sqrt{2\pi}} dx = \frac1{\sqrt{2\pi}}.$$
Plugging this back into your original equation, you obtain
$$\operatorname{Cov}(|D|,U) = \frac1{\sqrt{2\pi}} - \frac12\sqrt{\frac2\pi} = 0.$$
Intuitively, this makes sense. The random variable $U$ is purely a measure of the sign of $D$, and $|D|$ does not care about the sign of $D$. In fact, it is not too hard to show that $|D|$ and $U$ are independent.