Given a quadrangle $ABCD$ where two of the sides $AD$ and $BC$ are parallel with lengths $a$ and $b$ respectively. Futhermore we have the midpoint $M$ on $AB$ and $K$ on $CD$. The diagonals $AC$ and $BD$ intersects the line $KM$ at points $P$ and $Q$ respectively. I am tasked with expressing the distance $PQ$ in terms of $a$ and $b$.
This is problem in Euclidean geometry I've been stuck on for quite a while. So far I've narrowed it down to two cases: one where we get a trapezoid like figure and one where we the angles at $B$ and $D$ are greater than 90 degrees. I did two quick figures in paint (I apologize for my artistic qualities beforehand) to illustrates this.

So far I've been able to show that the two triangles formed by the diagonals and $AD$ and $BC$ are similar but that is a far as I'm able to get.
My current idea is to try to show that $KM$ is parallel with either of the two parallel line. Then the triangle formed by the diagonals and their intersection with $KM$ will be similar to both the other two triangles I found. This should enable me to find an expression for $PQ$
However I've been unable to find a way to show this.
Hint. To prove $MK$ is parallel to both $AD$ and $BC$.
Draw the line through point $K$ parallel to $AB$ and denote by $D'$ its intersection point with $AD$ and by $C'$ its intersection point with $BC$. Now, you have a quadrilateral $ABC'D'$ such that $AB$ is parallel to $C'D'$ by construction and $BC'$ is parallel to $AD'$ by the fact that $BC$ and $AD$ are parallel. What kind of quadrilateral is that? After that, what can you say about triangles $KDD'$ and $KCC'$, having in mind that $K$ is the midpoint of $CD$ and $BC$ is parallel to $AD$? Consequently, what can you say about the segments $KC'$ and $KD'$? How are they also related to $AB$ and its midpoint $M$?
Ok, as you discovered $KCC'$ and $KDD'$ are congruent and thus $D'K = C'K$ meaning that $K$ is the midpoint of $C'D'$. Quad $ABC'D'$ is a parallelogram because $AB$ is parallel to $C'D'$ by construction and $BC'$ is parallel to $AD'$ by the fact that $BC$ and $AD$ are parallel. Form here, look at $AMKD'$. we know by construction that $D'K$ is parallel to $AM$. But we also know that $$D'K = \frac{1}{2} D'C' = \frac{1}{2} AB = AM$$ because $D'C' = AB$ since $ABC'D'$ is a parallelogram and $K$ and $M$ are midpoints of $AB$ and $D'C'$ respectively. Therefore $D'K$ parallel to $AM$ and $D'K = AM$ implies that $AMKD'$ is a parallelogram too. Therefore, $MK$ is parallel to line $AD' \equiv AD$ and consequently parallel to line $BC$ as well.