Problem: Let $ABC$ be a scalene triangle with incenter $I$ whose incircle is
tangent to $\ol{BC}$, $\ol{CA}$, $\ol{AB}$ at $D$, $E$, $F$,
respectively.  Denote by $M$ the midpoint of $\ol{BC}$ and
let $P$ be a point in the interior of $\triangle ABC$
so that $MD = MP$ and $\angle PAB = \angle PAC$.
Let $Q$ be a point on the incircle such that $\angle AQD = 90^{\circ}$.
Prove that either $\angle PQE = 90^{\circ}$ or $\angle PQF = 90^{\circ}$.

Solution: We present two solutions.

\paragraph{Official solution.}
Assume without loss of generality that $AB < AC$; we show $\angle PQE=90^{\circ}$.
\begin{center}
  \begin{asy}
    size(9cm);

    pair A = dir(130);
    pair B = dir(210);
    pair C = dir(330);
    filldraw(A--B--C--cycle, opacity(0.2)+palecyan, blue);
    pair I = incenter(A, B, C);
    filldraw(incircle(A, B, C), opacity(0.3)+palered, red);
    pair D = foot(I, B, C);
    pair E = foot(I, C, A);
    pair F = foot(I, A, B);

    pair M = midpoint(B--C);
    pair P = extension(A, I, D, E);
    draw(A--P, orange);

    pair D1 = 2*M-D;
    pair Q = foot(D, A, D1);
    draw(P--Q--E, heavyred+1);
    draw(M--Q, red);
    markrightangle(E,Q,P,heavyred+1);

    pair N = midpoint(A--B);
    draw(N--M, dashed+orange);
    draw(D--E, dashed+orange);

    filldraw(CP(M, P), opacity(0.2)+palegreen, heavygreen+dashed);

    pair T = extension(A, Q, B, C);
    pair S = extension(D, I, A, T);
    draw(A--T, heavygreen);
    draw(D--Q, red);
    draw(D--S, dashed+red);

    dot("$A$", A, dir(A));
    dot("$B$", B, dir(B));
    dot("$C$", C, dir(C));
    dot("$I$", I, dir(I));
    dot("$D$", D, dir(D));
    dot("$E$", E, dir(P-D));
    dot("$F$", F, dir(F));
    dot("$M$", M, dir(M));
    dot("$P$", P, dir(200));
    dot("$Q$", Q, dir(25));
    dot("$N$", N, dir(N));
    dot("$T$", T, dir(T));
    dot("$S$", S, dir(70));

    /* Source generated by TSQ

    A = dir 130
    B = dir 210
    C = dir 330
    A--B--C--cycle
    I = incenter A B C
    incircle A B C
    D = foot I B C
    E = foot I C A RP-D
    F = foot I A B

    M = midpoint B--C
    P = extension A I D E R200
    A--P

    D1 := 2*M-D
    Q = foot D A D1 R25
    E--Q--P--M--Q
    !markrightangle(E,Q,P,heavyred+1);

    N = midpoint A--B
    N--M dotted
    D--E dotted

    CP M P dashed

    T = extension A Q B C
    S = extension D I A T R70
    A--T
    D--Q
    D--S dashed

    */
  \end{asy}
\end{center}

First, we claim that $D$, $P$, $E$ are collinear.
Let $N$ be the midpoint of $\ol{AB}$.
It is well-known that the three lines $MN$, $DE$, $AI$ are concurrent at a point
(see for example problem 6 of USAJMO 2014).
Let $P'$ be this intersection point, noting that $P'$ actually lies on segment $DE$.
Then $P'$ lies inside $\triangle ABC$ and moreover
\[ \triangle DP'M \sim \triangle DEC \]
so $MP' = MD$.
Hence $P'=P$, proving the claim.

Let $S$ be the point diametrically opposite $D$ on the incircle,
which is also the second intersection of $\ol{AQ}$ with the incircle.
Let $T = \ol{AQ} \cap \ol{BC}$.
Then $T$ is the contact point of the $A$-excircle;
consequently, \[ MD = MP = MT \] and we obtain a circle with diameter $\ol{DT}$.
Since $\angle DQT = \angle DQS = 90^{\circ}$ we have $Q$ on this circle as well.

As $\ol{SD}$ is tangent to the circle with diameter $\ol{DT}$,
we obtain \[ \angle PQD = \angle SDP = \angle SDE = \angle SQE. \]
Since $\angle DQS = 90^{\circ}$, $\angle PQE = 90^{\circ}$ too.

\paragraph{Solution using spiral similarity.}
We will ignore for now the point $P$.
As before define $S$, $T$ and note $\ol{AQST}$ collinear,
as well as $DPQT$ cyclic on circle $\omega$ with diameter $\ol{DT}$.

Let $\tau$ be the spiral similarity at $Q$
sending $\omega$ to the incircle.
We have $\tau(T) = D$, $\tau(D) = S$, $\tau(Q) = Q$.
Now
\[ I = \ol{DD} \cap \ol{QQ} \implies
\tau(I) = \ol{SS} \cap \ol{QQ} \]
and hence we conclude $\tau(I)$ is the pole of $\ol{ASQT}$
with respect to the incircle, which lies on line $EF$.

Then since $\ol{AI} \perp \ol{EF}$ too,
we deduce $\tau$ sends line $AI$ to line $EF$,
hence $\tau(P)$ must be either $E$ or $F$ as desired.

\paragraph{Authorship comments.}
Written April 2014.
I found this problem while playing with GeoGebra.
Specifically, I started by drawing in the points $A$, $B$, $C$,
$I$, $D$, $M$, $T$, common points.
I decided to add in the circle with diameter $DT$,
because of the synergy it had with the rest of the picture.
After a while of playing around,
I intersected ray $AI$ with the circle to get $P$,
and was surprised to find that $D$, $P$, $E$ were collinear,
which I thought was impossible since the setup should have been symmetric.
On further reflection, I realized it was because $AI$
intersected the circle twice, and set about trying to prove this.
I noticed the relation $\angle PQE = 90\dg$ in my attempts
to prove the result, even though this ended up being a corollary
rather than a useful lemma.