Given the perimeter, find the length $\overline{\rm PQ}$ in the following setup. 
Let $\overline{\rm AB}$ be a diameter of a circle $\omega$ and let $C$ be a point on $\omega$, different from $A$ and $B$. The perpendicular from $C$ intersects $\overline{\rm AB}$ at $D$ and omega at $E (\ne C)$. The circle with the center at $C$ and radius $\rm CD$ intersects $\omega$ at $P$ and $Q$. If the perimeter of the $\triangle{PEQ}$ is $p$, find the length of the side $\overline{\rm PQ}$.

I solved this question by taking $C$ on the diameter of $\omega$ perpendicular to $AB$. It turned out to be a very simple case where $\triangle{PEQ}$ was equilateral, and thus $\rm PQ = \frac{p}{3}$.
Now this is the correct answer as the question allows us to take $C$ anywhere. But I feel that it doesn't quite grasp the essence of the question. Could anyone help solve it for the general case where $C$ lies at any random point on $\omega$?


Let the radius of the circle centered at $C$ be $r$.
$$\implies \overline{\rm CP} = \overline{\rm CQ} = r$$
Therefore, in $\omega$, $\angle{CEQ} = \angle{CEP} = \theta$
And subtended by $\overline{\rm EP}, \angle{PQE} = \angle{PCE} = \delta.$ $\tag*{}$
Now in $\triangle{PEQ}$, we have:
$$\frac{\sin{\delta}}{\rm PE} = \frac{\sin{2\theta}}{\rm PQ} \tag{1}$$
And in $\triangle{PEC}$, we have:
$$\frac{\sin{\delta}}{\rm PE} = \frac{\sin{\theta}}{\rm CP} \tag{2}$$
From $(1)$ and $(2)$:
$$\rm PQ = {\rm CP} \cdot \frac{\sin{2\theta}}{\sin{\theta}} = 2r\cos{\theta} \tag{3}$$
Now in $\triangle{CEQ}$, we have:
$$\begin{align} \cos{\theta} & = \frac{{\rm QE}^2 + {\rm CE}^2 - {\rm CQ}^2}{2\cdot{\rm QE}\cdot{\rm CE}} \\ & = \frac{{\rm QE}^2 + {(2r)}^2 - {r}^2}{2\cdot{\rm QE} \cdot{2r}} \\ & = \frac{{\rm QE}^2 + 3{r}^2}{4r \cdot {\rm QE}}\end{align}$$ $$\implies {\rm QE}^2 - (4r\cos{\theta}){\rm QE} + 3r^2 = 0 \tag{4}$$
Similarly in $\triangle{CEP}$, we have:
$$\begin{align} \cos{\theta} & = \frac{{\rm PE}^2 + {\rm CE}^2 - {\rm CP}^2}{2\cdot{\rm PE}\cdot{\rm CE}} \\ & = \frac{{\rm PE}^2 + {(2r)}^2 - {r}^2}{2\cdot{\rm PE} \cdot{2r}} \\ & = \frac{{\rm PE}^2 + 3{r}^2}{4r \cdot {\rm PE}}\end{align}$$ $$\implies {\rm PE}^2 -(4r\cos{\theta}){\rm PE} + 3r^2 = 0 \tag{5}$$
From $(4)$ and $(5)$ we observe that $\rm PE$ and $\rm QE$ are the two roots of the equation: $$x^2 - (4r\cos{\theta})x + 3r^2 = 0$$
Therefore, ${\rm PE} + {\rm QE} = 4r\cos{\theta} \tag{6}$
Using $(3)$ and $(6)$, we get:
$$\begin{align} p & =  \rm PQ + (\rm PE + \rm QE) \\ & = 2r\cos{\theta} + (4r\cos{\theta}) \\ & = 6r\cos{\theta} \end{align}$$
Therfore, $$\boxed{\rm PQ = \frac{p}{3} = \frac{1}{3}\cdot\text{Perimeter}}$$
Hence proved.
