The proposition 1.7 in Higher Recursion Theory by Sacks states $f \in \Sigma_n^1 \iff f \in \Pi_n^1$ with the proof:
Since $f$ is a function, then,
$f(x)=y \iff \forall z. [y \neq z \implies f(x) \neq z]$.
If the left side of the above statement is $\Sigma^1_n$ ($\Pi^1_n$ respectively), then the right hand side is $\Pi^1_n$ ($\Sigma^1_n$ respectively). QED.
What I do not understand is that if $f(x)=y$ is $\Sigma^1_n$, then why should the right hand side be $\Pi^1_n$? I think it has to be at least $\Pi^1_{n+1}$ since there is a universal quantifier on $z$ and $[y \neq z \implies f(x) \neq z]$ is at least $\Sigma^1_n$ as $f(x)=y$ is $\Sigma^1_n$.
There are two things you are missing. Firstly, the $\forall z$ is a first-order quantifier, not a second-order one, so it gets subsumed by any higher order quantifiers hanging around. Secondly, as $f(x) = y$ is $\Sigma_n^1$, its negation is $\Pi_n^1$. Basically, you have $$ \forall z(\text{arithmetic statement} \rightarrow \neg \Sigma_n^1) $$ Which is the same as $$ \forall z(\text{arithmetic statement} \rightarrow \Pi_n^1) $$ Which is $\Pi_n^1$.