A quadrilateral version of fagnano's problem. Here is a problem from the german national math olympiad 2021. This problem looks very similar to fagnano's problem except it is quadrilateral.
The problem is as follows.
Let $P$ on $AB$ ,$Q$on $BC$ and $R$ on $CD$ and $S$ on $DA$ be points on the interior of the sides of a convex quadrilateral; $ABCD$.
Show that the following two statements are equivalent.
$(1)$ There is a choice for $P, Q, R, S$ for which $PQRS$ has the minimal perimeter.
$(2)$ The$ABCD$ is a cyclic quadrilateral with its circumcenter in its interior.
I couldn't do any better than this can anyone help me find the proper solution?
 A: Here is a link to the original problem, which - as stated - comes with a lot of details (and warnings regarding possible omissions of argument) for the candidates:
60. Mathematik-Olympiade, 4. Runde, Bundesebene, 1. Tag, Aufgabe 601142
60. Mathematik-Olympiade, 4. Runde, Bundesebene, 1. Tag, Aufgabe 601242
(60.th German National Mathematical Olympiad, June 2022, first day, Problem 601142 for the 11.th class, respectively 601242 for the 12.th.)
Note that a version of this problem was proposed in the preliminaries.
This may be a gift for the talented, curious student,
who could have tried to generalize on her / his own the situation.
But it may be also an unfair advantage if some teacher would have solved the general problem, and share the ideas and even the solutions with the students in the own neighbourhood.
Since i am in general unable to give a compact solution, for the main reason that i want to present the solution that one can find, not the solution that one can minimally reshape after having one, the following will be rather a story with many pictures. My hope is that the reader can extract the ideas better than in a compact solution, namely in a way that would also help in simlar situations.

We have to show two directions.
$(1) \Rightarrow (2)$
Assume that there is a minimizing configuration of points $P,Q,R,S$ for the perimeter function of the quadrilateral $PQRS$, so that $P,Q,R,S;A,B,C,D$ are all different points. A first touch thought is as follows. Assume we know the position of $P,Q,R$ only, where is $S$ located? A picture...

So we reflect $R$ w.r.t. $AD$, connect $P,R'$ with a line, intersect this line with $AD$, and... we may have two (well, three) cases, the intersection point $S^*$ is either an inner point of the segment $[AD]$, or not. In the
first case it is everything as we want and can proceed. Else, in the
latter case(s) the sum $P\Sigma + \Sigma R$, with $\Sigma\in[AD]$ is minimized for $\Sigma$ in either $A$, or $D$. And the candidate has to find and write a good detailed argument for this in the conditions of the competition. (Take some $\Sigma\in(AD)$, draw $\Delta P\Sigma R'$, either $A$ or $D$ is in its interior...) We obtain a contradiction, since $S$ must be in this minimizing point.
Apply this for all triples of points among $P,Q,R,S$ (instead of the triple $P,Q,R$) to obtain from $(1)$ the following property:
Property $\Pi$: The points $P,Q,R,S$ satisfy the reflection, billiard conditions, which mean for $S$ that $PS$ and $SR$ have same incidence angles in $S$ w.r.t. $AD$, i.e. $\widehat{ASP}=\widehat{RSD}$, and similar conditions are stated for $P,Q,R$ instead of $S$.
In a picture:

(With the following observation we are outside the competition, but it is useful to form the physical intuition. Imagine a rubber elastic band around the "buttons" $P,Q,R,S$, which can glide freely respectively on the sides of the triangle. Let the band find its stable state of minimal energy. Then in equilibrium, the tension in the band is the same, the two (tension) forces in $S$ going in directions $\overrightarrow{SP}$,  $\overrightarrow{SR}$ have same magnitude, let us add them, the sum must be normal to the gliding slit $AD$, to the "wall" $AD$, else if oblique, the button will glide in the direction of the projection... So the incidence angles must be equal. The situation with the Fagnano problem is the same one. The billiard property $\Pi$ must hold for a minimal perimeter triangle $\Delta PQR$ "inscribed" in a given triangle $\Delta ABC$.)
So the sum of $\hat A$, $\hat C$, and of an angle of each color is equal to the sum of angles in $\Delta APS$ and $\Delta CRQ$ together. Same for $\hat B$, $\hat D$, and...
This gives
$$
\hat A+\hat C=\hat B+\hat D=\frac 12(\hat A+\hat B+\hat C+\hat D)
=\frac 12\cdot 360^\circ=180^\circ\ ,
$$
so $ABCD$ is cyclic.
Let us play the following "game", we apply succesively reflections on a point  $X$ in the plane. Set $X_0=X$.
Let $X_1$ be the reflection of $X_0$ w.r.t. $BC$.
Let $X_2$ be the reflection of $X_1$ w.r.t. $CD$.
Let $X_3$ be the reflection of $X_2$ w.r.t. $DA$.
Let $X_4$ be the reflection of $X_4$ w.r.t. $AB$. What is the composition $X\to X_4$? It is an isometry, it preserves the orientation, so it is a rotation composed with a translation. It turns out, there is no rotational part, this will be addressed soon in the sequel.
A picture first, we have the "paths" $X_0\to X_1\to X_2\to X_3\to X_4$ for some few special points, $P,B,C$:

So the "snake" $PQRSP$ gets untangled first as $P_1QRSP$, then as
$P_2RSP$, then $P_3SP$, and finally $P_4P$, so the length of this segment is the perimeter of $PQRS$:
$$
\begin{aligned}
\operatorname{Perimeter}(PQRS)
&=PQ+QR+RS+SP\\
&=P_1R+RS+SP\\
&=P_2S+SP\\
&=P_3P\\
&=P_4P\ .\\
\end{aligned}
$$
Note that $P_4,P,Q$ are colinear, because of the green angles.
So if we "know only $P$", we can recover the other points by constructing
$P\to P_1\to P_2\to P_3\to P_4$, then intersecting $P_4P$ with $BC$ to get $Q$, and so on.
To see there is no rotational part one can start with the vector $\overrightarrow{BX}=\overrightarrow{B_0X_0}$ for a point $X$ (e.g. $X=P$ or $X=A$) in
$AB$, and see how it is moved via the isometry $X\to X_4$. Consider the images $\overrightarrow{B_1X_1}$, ... , $\overrightarrow{B_4X_4}$
after each reflection, and the angles built with a fixed direction, my choice is the direction $\overrightarrow{BA}$ below. To have a dedicated control of the total rotational part, we may pick some favourite origin $\Omega$ in the plane, draw parallels $s'$ through $\Omega$ to the sides $s$, write each reflection w.r.t. a side $s$ as a translation (from vertex on $s$ to $\Omega$), reflection w.r.t. $s'$, and translation back. Then in the total composition, we may switch the order, moving all the reflections to the end of the compositions chain. (Reflections and translations do not commute, but we can exchange the order in a composition $RT_v$ (translation in direction $v$, than reflection) as $T_{Rv}R$ with same reflection part $R$.) So we analyze only the reflections w.r.t. lines through $\Omega$ for the given purpose.

Then some point on the circle around $\Omega$ making angle $x$ w.r.t. the "zero-ray" $s'_{AB}$ is  reflected on the circle successively as follows:
$$
\begin{aligned}
x 
&\to 0^\circ-x\\
&\to -2\hat B - (0^\circ-x)\\
&\to -2(\hat B+\hat C) -(-2\hat B - (0^\circ-x))\\
&\to -2(\hat B+\hat C+\hat D) 
     -\Big(-2(\hat B+\hat C) -(-2\hat B - (0^\circ-x))\Big)
\\
&= -2(\hat B+\hat D) + x = -360^\circ + x \cong x
\ ,
\end{aligned}
$$
modulo integer multiples of a full rotation around $\Omega$. Trivial rotation obtained.
Now let $P$ "glide" on $AB$, and consider an other instance $P'$ "slightly near $P$". Then $\overrightarrow{PP_4}$ is the same vector as $\overrightarrow{P'P'_4}$, in particular $PP_4\|P'P'_4$, and after constructing $P'_4P'\cap BC=Q'$ we have $PQ\|P'Q'$, and after completing to $P'Q'R'S'$ we have the same perimeter. (The length of $P'_4P'$ and $P_4P$ is the same one.) Thus we obtain infinitely many other solutions / minimizing configurations (at least in a "small interval" around $P$ on $AB$).
But a too big deformation $P'$ of $P$ may make $P'$ leave $AB$, or $Q'$ leave $BC$, or $R'$ leave $CD$, or $S'$ leave $DA$.
In a picture:

So if there is a perimeter minimizing solution, we obtain some more by letting $P$ slide on $AB$ - at least in a small interval. Let us try to get a formula for the minimal perimeter. (This is not needed for the solution, please skip if it feels irrelevant.) This is the length of one and each vector from $X$ to $X_4$, $X$ running in the plane. To take $X=C$ is fine, since the first two reflections keep it fixed, $C=C_0=C_1=C_2$.

The points $C_3,C_4$ have $AC=AC_3=AC_4$, and the angle between $AC$ and $AC_4$ is
$$
\begin{aligned}
\widehat{CAC_4} 
&=
\widehat{CAC_3}   +
\widehat{C_3AC_4} 
\\
&=
2\Big(\widehat{DAC_3}   + (180^\circ-\widehat{C_3AB})\Big)
\\
&=360^\circ -2(\widehat{C_3AB}-\widehat{C_3AD})=360^\circ - 2\hat A=2\hat C\ .
\\
&\qquad
\text{ We obtain a formula for the minimal perimeter from $\Delta ACC_4$:}
\\
\operatorname{Permiter}(PQRS)
&=
CC_4
=2AC\sin\hat C
=AC\cdot BD\cdot\frac{2\sin\hat C}{BD}
\\
&=\frac{AC\cdot BD}r\ ,
\end{aligned}
$$
where $r$ is the circumradius of $\Delta BCD$, and thus of $ABCD$.
We have a formula for the minimal perimeter as the product of diagonals divided by the radius of $\odot(ABCD)$.
We can also get a formula for the angle $\widehat{APP_4}$ between the direction
$XX_4\|PP_4\|CC_4$ and $AB$. Note that
$\widehat{APP_4}=\widehat{SPA}=\widehat{BPQ}$ from the snake property, and that
$\widehat{APP_4}=\widehat{CC_4C_3}$ because of $PP_4\|CC_4$ and $PA\perp C_4C_3$.
The angle at center $\widehat{CAC_3}$ in the circle $\odot(A)$ with radius $AC=AC_2=AC_3=AC_4$ is twice $\widehat{CC_4C_3}$. We can conclude with a formula for the green reflection angles in $P$:
$$
\widehat{SPA}=\widehat{BPQ}
=
\widehat{APP_4}
=90^\circ-\widehat{CC_4C_3}
=90^\circ-\widehat{CAD}\ .
$$
In particular $\widehat{CAD}<90^\circ$, so the angle built between a side and a diagonal is $<90^\circ$, so the circumcenter of the cyclic quadrilateral $ABCD$ lies inside $ABCD$.

$(2) \Rightarrow (1)$
Let us start with a cyclic quadrilateral $ABCD$, so that its circumcenter $O$ is an interior point. In particular, the arcs
$\overset\frown{AB}$,
$\overset\frown{BC}$,
$\overset\frown{CD}$,
$\overset\frown{DA}$
have each measure $<180^\circ$.
Let $X=AC\cap BD$ be the intersection of its diagonals.
Denote by $P,Q,R,S$ the projections of $X$ on the lines $AB$, $BC$, $CD$, $DA$. Then these projections are respectively inside  the open segments $(AB)$, $(BC)$, $(CD)$, $(DA)$. For instance $P\in(AB)$ because the angles in $A,B$ in $\Delta XAB$ are both $<90^\circ$:
$$
\begin{aligned}
\widehat{BAX} &= \widehat{BAC} =\frac 12\overset\frown{BC} <90^\circ\ ,\\
\widehat{ABX} &= \widehat{ABD} =\frac 12\overset\frown{AD} <90^\circ\ .
\end{aligned}
$$
Then $P,Q,R,S$ satisfy the billiard property $\Pi$.

For $P$, this is in the above picture using $XPAS$ and $XPBQ$ cyclic,
two opposite right angles:
$$
\widehat{XPQ} =
\widehat{XBQ} =
\widehat{DBC} =
\widehat{DAC} =
\widehat{SAX} =
\widehat{SPX} =
\ .
$$
Using arguments already mentioned in the first part, the property $\Pi$ insures the minimalizing perimeter property for $PQRS$.
$\square$
