A space is Hausdorff iff the diagonal is closed Let X be a topological space. Prove that X is a T2-space if and only if
$A = \{ (x,x) : x \in X \}$ is closed in $X \times X$.

I've been able to prove first part of the result but not the converse.

For the first part,

We have X is T2. hence X x X is also T2. Hence X x X is T1.

Then for any z belonging to A and y not belonging A, there exist an open set U in X x X such that y belongs to U but z doesn't belong to U.

Hence for every z belonging to A and for a fixed y not belonging to A , there exists an open set V(y) in X x X such that "V(y) intersection A" is empty.

hence (X x X) - A = Union of all V(y)'s such that y doesn't belong to A.

since arbitrary union of open sets is open, hence (X x X) - A is also open in
X x X , Implying that A is closed in X x X. ( Is this proof valid ? )

Now how to prove the converse part ?
your prove is not correct at the part "hence (X x X) - A = Union of all V(y)'s such that y doesn't belong to A.". 
This question can be solved directly by using the fact that  every points have neighbourhood  $U_1 \times U_2$ with$U_1,U_2$ is open subset. try to use thit :)
your prove is not correct at the part "hence (X x X) - A = Union of all V(y)'s such that y doesn't belong to A.". 
This question can be solved directly by using the fact that  every points have neighbourhood  $U_1 \times U_2$ with$U_1,U_2$ is open subset. try to use thit :)