not following two steps in proof that $\int_{0}^{\infty}\cos(x^2) = \frac{\sqrt{2 \pi}}{4}$ Hi: I'm reading some notes I found on complex analysis on the internet. In the example, they prove that 
$$\int_{0}^{\infty} \cos(x^2) = \int_{0}^{\infty} \sin(x^2) = \frac{\sqrt{2\pi}}{4}.$$
I understand a lot of the proof so I don't think that I need to write down all the steps.
I will just provide what I think is necessary for readers to understand my lack of understanding.
The example starts off with

"We shall consider the analytic function $f(z) = e^{(iz^2)}$ over a contour C of the form of a circular wedge in the first quadrant. Then contour has three edges:
(1) a line segment of length R from the $0$ to the point $A$.=,
(2) from $A$ to $B$ over a circular arc of angle $\frac{\pi}{4}$ (so $B = R e^{i \pi/4})$ and
(3) from $B$ to $0$.

That make sense. Then the author breaks the integral into three pieces so that
$$\int_{C} f(z) dz = \int_{OA} f(z) dz + \int_{AB} f(z) dz + \int_{BO} f(z) dz = 0.$$
by cauchy's theorem.  That makes sense too. 
But then, when  evaluating the third integral, the author has
$$\begin{align}
I_{3}(R) 
&= \int_{BO} e^{(i z^2)} dz 
\\&= \int_{R}^{0}  e^{-r^2} e^{i \pi/4} dr
\\&= -e^{i \pi/4} \int_{0}^{R} e^{-r^2} dr.
\end{align}$$
Then the author explains

" for $I_{3}(R) $ we used $ z = r e^{i \pi/4}, 0 \le r \le R; z^2 = r^2e^{i \pi/4}; dz = e^{i \pi/4} dr $ ".

So, given  what was used for $I_{3}(R)$ , I don't see how that integral is obtained. I must be missing something but could someone spell out how the negative comes about ? In fact, I don't even see where the $e^{i \pi/4}$ part of $z^2$ went ? Basically, I don't follow the integral construction at all.
Also, my second confusion ( definitely there's a typo somewhere causing this confusion ) occurs immediately after above where the author states: 

" Next observe that: $\displaystyle I_{3}(R) = -e^{i\pi/4} \int_{0}^{R} e^{-r^2} dr = - \frac{\sqrt{2}}{2}(1 + i) \int_{0}^{R} e^{-r^2} dr. $ As $R \longrightarrow \infty$, we find : $\lim_ {R\to\infty} I_{3}(R) = - \frac{\sqrt{2 \pi}}{2} (1 + i).$ "

Is the above correct ( I don't know how to evaluate the integral ) because later on in the proof, he states that 
$ - I_{3}(R) =   \frac{\sqrt{2 \pi}}{4} (1 + i).$ So clearly there has to be a typo in one of the statements about what $I_{3}(R)$ is equal to.
Thank you very much for clearing up my two confusions.
 A: On second confusion:
from http://en.wikipedia.org/wiki/Gaussian_integral
$$\int_{-\infty}^{+\infty} e^{-x^2}\,dx = \sqrt{\pi}$$
hence
$$\lim_{R \to \infty} \int_0^R e^{-r^2} = \frac{\sqrt{\pi}}{2}$$
therefore
$\lim_{R \to \infty} I_3(R) = \lim_{R \to \infty} (-\frac{\sqrt{2}}{2}) (1 + i) \int_0^R e^{-r^2} = -\frac{\sqrt{2}}{2} (\lim_{R \to \infty} \int_0^R e^{-r^2} + i \lim_{R \to \infty} \int_0^R e^{-r^2}) = -\frac{\sqrt{2}}{2} (\frac{\sqrt{\pi}}{2} + i\frac{\sqrt{\pi}}{2}) = - \frac{\sqrt{2 \pi}}{4} (1 + i)$ 
A: I decided to answer the question on the complex integration tag so the following answer is attributed to @Per Manne. I will check off the answer.
=============================================================
There seems to be a misprint in the part which says what $z^2$ is supposed to be. Since $z=r{\rm e}^{{\rm i}\pi/4}$ on $BO$, you get that $$z^2=r^2{\rm e}^{{\rm i}\pi/2}={\rm i}r^2$$ and hence $f(z)={\rm e}^{-r^2}$. 
Putting things together, just substitute ${\rm d}z={\rm e}^{{\rm i}\pi/4}{\rm d}r$ and remember that along the segment $BO$, the parameter $r$ will start at $R$ and decrease to $0$. The minus sign in the last expression for $I_3(R)$ comes from switching the direction and letting $r$ run from $0$ to $R$ instead.
