4 Bugs chasing each other differential equation This is from a problem seminar and I need help figuring out the solution.
Four bugs, $A,B,C,D$ are initially placed at the corners of a unit square. From a given initial moment, all four crawl simultaneously at one and the same speed $s>0$, $A$ towards $B$, $B$ towards $C$, $C$ towards $D$, and $D$ towards $A$, with each heading at every instant along the line joining it with its target.
Find a system of differential equations describing the trajectory of $A$.
Do the bugs eventually all meet at the center of the square? If so, how long did it take?
My attempt so far:
$\def\grad{\mathbf\nabla}$
$\newcommand{\norm}[1]{\left\Vert #1 \right\Vert}$
Call ${\vec x}_1,{\vec x}_2,{\vec x}_3,{\vec x}_4$  the positions in the plane of $A,B,C,D$ respectively.
Then
$$\grad {\vec x}_1 = \frac{{\vec x}_2-{\vec x}_1}{\norm{{\vec x}_2-{\vec x}_1}}s$$
$$\grad {\vec x}_2 = \frac{{\vec x}_3-{\vec x}_2}{\norm{{\vec x}_3-{\vec x}_2}}s$$
$$\grad {\vec x}_3 = \frac{{\vec x}_4-{\vec x}_3}{\norm{{\vec x}_4-{\vec x}_3}}s$$
$$\grad {\vec x}_4 = \frac{{\vec x}_1-{\vec x}_4}{\norm{{\vec x}_1-{\vec x}_4}}s$$
with ${\vec x}_1(0) = (0,0),\  {\vec x}_2(0) = (0,1),\ {\vec x}_3(0) = (1,1),\ {\vec x}_4(0) = (1,0)$.
I have noticed that the sum of the gradients is 0, but I don't know if that is helpful or not. Can someone help me figure this problem out?
 A: Hints: Assume the square is centered at zero and the affix of the position of $A$ at time $t$ is $r(t)\mathrm e^{\mathrm i\theta(t)}$. Then:


*

*The affixes of the positions of $B$, $C$ and $D$ at time $t$ are $\mathrm ir(t)\mathrm e^{\mathrm i\theta(t)}$, $-r(t)\mathrm e^{\mathrm i\theta(t)}$ and $-\mathrm ir(t)\mathrm e^{\mathrm i\theta(t)}$ respectively. 

*Hence, for example, the line $AB$ has the direction of $(\mathrm i-1)\mathrm e^{\mathrm i\theta(t)}$. 

*At time $t$, the tangent of the curve that $A$ makes has the direction of $(r'(t)+\mathrm ir(t)\theta'(t))\mathrm e^{\mathrm i\theta(t)}$.

*The square of the speed at time $t$ is $(r'(t))^2+(r(t)\theta'(t))^2$.


The steps of the proof are as follows. Points 2. and 3. combined yield a first order differential equation characterizing the motion of $A$, hence of $B$, $C$ and $D$ through point 1. Solving this yields $\theta(t)$ as a function of $r(t)$. Finally, point 4. determines $r(t)$.
A: Let the process take place in the square $|x|\leq 1$, $|y|\leq1$ of the complex $z$-plane. If  $t\mapsto z(t)$ describes the movement of ant $A_0$ then the movement of the other ants is given by
$$t\mapsto i^k\ z(t)\qquad(1\leq k\leq 3)$$
(for a proof see the appendix below). By the given law of motion we have
$$\dot z(t)\ =\ \lambda(t)\bigl(i\,z(t)-z(t)\bigr)$$
for some function $t\mapsto \lambda(t)>0$. As the velocity $v$ is given the factor $\lambda$ is determined by the condition
$$v=|\dot z|=\lambda \sqrt{2}\,|z|\ .$$
Therefore $t\mapsto z(t)$ obeys the differential equation
$$\dot z=v\ {i-1\over\sqrt{2}}\ {z\over|z|}\ .$$
We now write $z$ in the form $z(t)=r(t)\,e^{i\theta(t)}$, whereupon our differential equation becomes
$$(\dot r + i r\dot\theta)e^{i\theta}\ =\ v\Bigl({i\over\sqrt{2}}-{1\over\sqrt{2}}\Bigr)\,e^{i\theta}\ .$$
Cancelling $e^{i\theta}$ and separating real and imaginary parts gives
$$\dot r=-{v\over\sqrt{2}}\ ,\qquad \dot\theta ={v\over\sqrt{2}}\ {1\over r}\ ,$$
and we have the initial conditions $r(0)=\sqrt{2}$, $\ \theta(0)={\pi\over4}$.
We immediately get $$r(t)=\sqrt{2}\Bigl(1- {v\over 2}\ t\Bigr)\ ,$$ from which we deduce that the process is over after time $T:={2\over v}$. Using this we find via a second integration
$$\theta(t)\ =\ {\pi\over4} +\log{1\over 1-{v\over2} t}\qquad(0\leq t<T)\ .$$
This shows that the ants turn ever faster around the origin towards the end of the process.
Appendix, added 10/12/18:
Note that for any given initial conditions ${\bf z}(0)=\bigl(z_1(0),\ldots, z_4(0)\bigr)$ the behaviour $t\mapsto{\bf z}(t)\in{\mathbb C}^4$ of the ants is uniquely determined for all $t$, up to the first collision.
The inherent symmetry suggests the working hypothesis (a heuristic tool) that the configuration of the ants is a square at all times. Using this hypothesis  a solution $t\mapsto{\bf z}(t)$ is found that fulfills all requirements of the problem; hence it is the solution.
Of course there is also a structural proof that there will be no "symmety breaking". The "natural laws" that govern the behavior of the ants (described in the linked question) are invariant under rigid movements (rotations or translations) of the plane. This implies the following: If $T$ is such a movement  then replacing the initial conditions ${\bf z}(0)$ by $${\bf w}(0):=\hat T{\bf z}(0):=\bigl(Tz_1(0),\ldots, Tz_4(0)\bigr)$$ results in the solution $t\mapsto{\bf w}(t)=\hat T{\bf z}(t)$. In the case at hand we have ${\bf z}(0)=(1,i,i^2,i^3)$, and $T$ is the $90^\circ$ rotation $z\mapsto iz$ around the origin, so that ${\bf w}(0)=(i,i^2,i^3,1)$. It follows that $w_1(t)=i z_1(t)$ for all $t$. On the other hand $w_1(t)$ can be viewed as orbit of the ant starting at $i$ in the original ant problem.
A: This problem can be solve using a well know result of calculus for polar coordinates

    $tan(\psi) = \frac{r(\theta)}{\frac{dr(\theta)}{d\theta}}$

where $\psi$ is the angle between tangent line and radial line at $r(\theta)$.
Let's use center of square (or n sided regular polygon) as the origin of polar coordinates and a vertex on line $\theta = 0$.  So the vertex's coordinate is (r, $\theta$) = (1, 0).
Since each bug is chasing adjacent bug, all of them stay on some square (or n-polygon) of smaller size.  Thus tangent of a bug's trace contains side of a square (n-polygon).  Using this fact, we can conclude $\psi$ is sum of half of internal angle and external angle of a square (n-polygon), i. e.


*

*$\psi = \frac{3\pi}{4}$ for square, thus $\tan(\psi)=-1$

*$\psi = \frac{1}{2} \cdot \pi \cdot \frac{n-2}{n} + \frac{\pi}{n} = \pi \cdot (\frac{1}{2} + \frac{1}{n})$ for n-polygon, thus $tan(\psi) = -\frac{1}{tan(\frac{\pi}{n})}$


Using these result we can obtain the following differential equation for r($\theta$):

$\frac{dr(\theta)}{d\theta} = -tan(\frac{\pi}{n}) \cdot r(\theta)$

Integrate it and apply the initial condition we have

$r(\theta)= e^{-\tan(\frac{\pi}{n}) \cdot \theta} $

The length of bug trace can be calculated using following formula:
$D = \int _0^{\infty} \sqrt{(dr)^2 + r^2 (d\theta)^2 } =
 \sqrt{\tan^2(\frac{\pi}{n}) + 1} \int _0^{\infty} e^{-\tan(\frac{\pi}{n}) \cdot \theta} d \theta =
 \frac{\sqrt{\tan^2(\frac{\pi}{n}) + 1}}{\tan(\frac{\pi}{n})}=\csc(\frac{\pi}{n})$
For a square with its center at origin and one vertex at (0, 1), we have $D=\sqrt{2}$ which is length of its sides.
A: I think I solved this. If bug 1 has coordinates $(x,y)$ then bug 2 has coordinates $(y,1-x)$ so since bug 1 moves into the direction of bug 2 the differential equation is 
$$\frac{dy}{dx} = \frac{1-x-y}{y-x}.$$ 
Substitution of $x=p+1/2$ and $y=q+1/2$ leads to 
$$\frac{dq}{dp}=\frac{p+q}{q-p}$$ 
and then with $f=q/p$ and  $p=\exp(s)$ we get 
$$\frac{df}{ds}=\frac{1+f^2}{1-f}$$
The solution starting at $(x,y)=(0,0)$ is the found through separation of variables
$$p = -\frac{\exp(\arctan(f)-\arctan(1))}{\sqrt{2(1+f^2)}}$$ 
from which as function of varying parameter $f$, $x$ and $y$ can be obtained.
A: From the previous result, changing to polar coordinates ( $p=r\cos(\Theta), q=r\sin(\Theta)$ ) one obtains a more transparent form of the solution:
$r= \exp(\Theta-5\cdot\frac{\pi}{4})/\sqrt{2} $
Letting theta decrease from zero to minus infinity, the path of the bug traced is seen to be be a logarithmic spiral.
A more elegant approach is perhaps using complex numbers. With the origin of the complex plane in the lower left corner of the square, and the two bugs are at $z$ and $i-iz$, the differential equation becomes 
$\frac{dz}{dt}  + (1+i)z = i$
for which the solution can be written immediately
$z = \frac{1+i}{2}  (1-\exp(-(i+1)\cdot t))$  for  $t\geq0$
which represents, of course, the same spiral. Since $|dz|=\exp(-t)dt$ it follows that total length of the path equals 1, the length of the side of the square. 
