How would I find the function given the magnitude plot and the phase response?
There is more than one way to write the same thing. You can use $rect()$ functions or define it piece-wise, but in the end it is the same thing, since the $rect()$ is just a shorthand for a piece-wise definition. 

If you do it in sections, you don't need to use $rect()$ function at all, you could simply write is as

$$X(j \omega) = \begin{cases}
 &amp;  j \text{ if } -\pi &lt; \omega &lt; 0\\ 
 &amp; -j \text{ if } 0 &lt; \omega &lt; \pi \\ 
 &amp; 0  \text{ otherwise}
\end{cases}
$$

The answer just puts it together as two rectangle functions: one for negative frequencies and one for the positive ones. 

Either way would be correct and I don't think one is "better" than the other unless there are some clear criteria what "better" means.