Definition of Linkage Desiquilibrium (LD)
Just need to solve the equation. p1 = X11 + X12; q1 = X11 + X21; 1 = X11 + X12 + X21 + X22.

D = X11 - (X11 + X12) * (X11 + X21)

D = X11 - (X11X11 + X11X21 + X11X12 + X12X21)

D = X11 - X11X11 - X11X21 - X11X12 - X12X21

D = X11 * (1 - X11) - X11X21 - X11X12 - X12X21

D = X11 * (X11 + X12 + X21 + X22 - X11) - X11X21 - X11X12 - X12X21

D = X11 * (X12 + X21 + X22) - X11X21 - X11X12 - X12X21

D = X11X12 + X11X21 + X11X22 - X11X21 - X11X12 - X12X21

D = X11X22 - X12X21

Sorry for the very long answer, but I thought it would be more clear if I wrote everything out.