Find the points at which $\max_{|z|=r} |e^{z^2-iz}|$ is attained 
Show that the $\max_{|z|=r} |e^{z^2-iz}|$ is attained at the point $ir$ when $r\le 1/4$ and at $re^{i\theta}, \theta=\sin^{-1}(1/4r)$, when $r>1/4.$

We have $|e^{z^2-iz}|=e^{Re(z^2-iz)}$, so we need to maximize the quantity of $Re(z^2-iz)$. Since $z=re^{i\theta}$, we have $Re(z^2-iz)=r^2 \cos 2\theta+r\sin \theta$. But how can we find the $\theta$ that maximizes this quantity for $r>1/4$ and $r\le 1/4$?
 A: $$\Re(z^2-iz)=y=r^2\cos2\theta+r\sin\theta$$
Take $r$ as a constant. Then
$$y'=-2r^2\sin2\theta+r\cos\theta$$
$$=-4r^2\sin\theta\cos\theta+r\cos\theta=(-4r\sin\theta+1)(r\cos\theta)$$
and this is zero when either $\cos\theta=0$ ($\theta=\pm\frac\pi2$) or $-4r\sin\theta=-1$ ($\theta=\sin^{-1}\frac1{4r}$).
When $\theta=\pm\frac\pi2$, $y=-r^2\pm r$. We want the maximum, so we choose $\theta=\frac\pi2$ and hence $y=-r^2+r$. If $r<\frac14$ then $\sin^{-1}\frac1{4r}$ is complex and $\theta=\frac\pi2$ gives the global maximum, whence $z=ir$. Otherwise, $y$ at $\theta=\sin^{-1}\frac1{4r}$ evaluates to
$$r^2\cos2\sin^{-1}\frac1{4r}+r\sin\sin^{-1}\frac1{4r}$$
$$=r^2\left(1-2\left(\frac1{4r}\right)^2\right)+\frac r{4r}$$
$$=r^2\left(1-\frac1{8r^2}\right)+\frac14=r^2+\frac18$$
The difference between $r^2+\frac18$ and $-r^2+r$ ($2r^2-r+\frac18=\frac18(4r-1)^2$) is positive if $r>\frac14$, so $\theta=\sin^{-1}\frac1{4r}$ achieves the global maximum in this range. When $r=\frac14$, $\theta=\frac\pi2$ both ways, so the $z=ir$ formula is also valid at this point. The entire problem is thus solved.
