When i was writing my programming project the other day i ran into an interesting problem that i couldn't solve, i spent a while trying solutions with absolute values but none of that worked.
Here's the problem:
I saw a similar problem on this site: Finding the fourth vertex of a square But my problem differs in the fact that you cannot immediately know the diagonal of the square since the points are given in a random order.
Is this problem even possible? And if not why not?

Let $u,v,w\in\mathbb R^2$ be the three known vertices (we don't require the four sides of the square to be parallel to the $x$-axis or $y$-axis) and $c$ be the centre of the square. Then $c$ is also the centre of the unique circumcircle of the square. That is, $c$ is the unique solution of $\|u-c\|^2 = \|v-c\|^2 = \|w-c\|^2$. Expanding the squared norms, we get $$ 2c^T\pmatrix{u-v&v-w} = (\|u\|^2-\|v\|^2,\ \|v\|^2-\|w\|^2). $$ Thus $$ c^T=\frac12(\|u\|^2-\|v\|^2,\ \|v\|^2-\|w\|^2)\pmatrix{u-v&v-w}^{-1} $$ and the remaining vertex is given by $4c-(u+v+w)$.