Show that $ABCD$ has an incircle if and only if $\frac {1}{PE} + \frac {1}{PG} = \frac {1}{PF} +\frac {1}{PH}$ Let $ABCD$ be a convex quadrilateral.Let the diagonals $AC$ and $BD$ intersect in $P$.Let $PE,PF,PG,PH$ be the altitudes from $P$ onto the sides $AB,BC,CD$ and $DA$ respectively.Show that $ABCD$ has an incircle if and only if

$\frac {1}{PE} + \frac {1}{PG} = \frac {1}{PF} +\frac {1}{PH}$

 A: Source: http://www.artofproblemsolving.com/Forum/blog.php?u=166324&b=103587
Let me denote the distances $PE,PF,PG,PH$ as $h_1,h_2,h_3,h_4$. Let $AB=a,BC=b,CD,c,DA=d$
$\frac{h_1}{h_4}=\frac{d(C,AB)}{d(C,AD)}=\frac{b \sin B}{c \sin D}$
$\frac{h_1}{h_2}=\frac{d(D,AB)}{d(D,BC)}=\frac{d \sin A}{c \sin C}$
$\frac{h_1}{h_3}=\frac{h_1}{h_2} \cdot \frac{h_2}{h_3} = \frac{d \sin A}{c \sin C} \cdot \frac{d(A,BC)}{d(A,CD)}=\frac{d \sin A*a \ sin B}{c \sin C*d \sin D}$
Therefore, we get
$\frac{1}{h_1}+\frac{1}{h_3}=\frac{1}{h_2}+\frac{1}{h_4}$
$\iff 1+\frac{h_1}{h_3}=\frac{h_1}{h_2}+\frac{h_1}{h_4}$
$\iff 1+\frac{d \sin A \cdot a \sin B}{c \sin C \cdot d \sin D}=\frac{d \sin A}{c \sin C}+\frac{b \sin B}{c \sin D}$
$\iff a \sin A \sin B+ c \sin C \sin D=b \sin B \sin C+ d \sin D \sin A (\star)$
For the 'if' part, let r be the inradius of ABCD. Then, we get 
$a=r \left( \cot \frac{A}{2} + \cot \frac{B}{2} \right) = r \frac{\sin \frac{A+B}{2}}{\sin \frac{A}{2} \sin \frac{B}{2}}$
$
\implies a \sin A \sin B = 4r \cos \frac{A}{2} \cos \frac{B}{2} \sin \frac{A+B}{2}$
$=4r \cos \frac{A}{2} \cos \frac{B}{2} \sin \frac{C+D}{2}$
$= 4r \cos \frac{A}{2} \cos \frac{B}{2} \cos \frac{C}{2} \cos \frac{D}{2} \left( \tan \frac{C}{2} + \tan \frac{D}{2} \right)$
$= 4r \gamma \left( \tan \frac{C}{2} + \tan \frac{D}{2} \right)$
$where  \gamma=\cos \frac{A}{2} \cos \frac{B}{2} \cos \frac{C}{2} \cos \frac{D}{2}$.
Analogously, $b \sin B \sin C = 4r \gamma \left( \tan \frac{D}{2} + \tan \frac{A}{2} \right)$
$c \sin C \sin D = 4r \gamma \left( \tan \frac{A}{2} + \tan \frac{B}{2} \right)$
$d \sin D \sin A = 4r \gamma \left( \tan \frac{B}{2} + \tan \frac{C}{2} \right)$
It is now easily seen that both sides of equation $(\star)$ are equal to $4r \gamma \left( \tan \frac{A}{2} + \tan \frac {B}{2} + \tan \frac{C}{2} + \tan \frac{D}{2} \right)$, hence the proof of the 'if' part is complete.
For the 'only if' part. Suppose first that in ABCD, both pairs of opposite sides are parallel. Then, the hypothesis, $a \sin A \sin B+ c \sin C \sin D=b \sin B \sin C+ d \sin D \sin A$ reduces to $a+c=b+d$ so ABCD becomes a rhombus and it obviously has an incircle. So we'll assume that ABCD has atleast one pair of nonparallel opposite sides, WLOG, they are AD and BC. Assume that ABCD is not tangential. There exists a circle $\Gamma$ touching segments $DA,AB,BC$. Because of our assumption, this circle does not touch side CD. Construct a parallel to CD which is tangent to the circle, and meeting BC,AD at C',D' respectively. Let BC' = b', C'D'=c' and D'A=d'. Since quadrilateral ABC'D' is tangential, we have
$a \sin A \sin B+ c' \sin C \sin D=b' \sin B \sin C+ d' \sin D \sin A$
Along with the equation, 
$a \sin A \sin B+ c \sin C \sin D=b \sin B \sin C+ d \sin D \sin A$
we get 
$(CD - C'D') \sin C \sin D = C'C \sin B \sin C + D'D \sin D \sin A$
If $\Gamma$ intersects the segment CD, then note that $C'C$ and $D'D$ are negative, while $CD-C'D' $is positive, contradiction. If $\Gamma$ does not intersect the segment $CD$, then $C'C$ and $D'DD'D$ are positive, while $CD - C'D'$ is negative, again a contradiction. Thus, we conclude that $\Gamma$ is tangent to $CD$ and hence, $ABCD$ is tangential.
