Image and preimage of a function 
Given the function $f(x)=x^{2}-4x-5$, $A=[0,3)$ and $B=[0,1]$, find $f(A)$ and $f^{-1}(B)$.

I found $f(A)$ by looking at the graph $f([0,3))=[-9,-5]$  but how would I calculate this without the graph? If I plug in $0$ into $f$ I get $-5$, and if I plug in $3$ I get $-8$, when I should get $-9$.

$$f(x)=x^2-4x-5=(x-2)^2-9$$
The vertex of $f$ lies at $(2,-9)$ and 2 lies in $[0,3)$, so $f[A]$ has a closed lower endpoint at $-9$. 0 is farther from 2 than 3 is, so $f(0)=-5$ constitutes the upper endpoint, which is also closed. Hence $f[A]=[-9,-5]$.
As for $f^{-1}[B]$, solve for the places where $f(x)$ attains the endpoint values of $B$:
$$f(x)=0\text{ when }x=-1\text{ or }x=5$$
$$f(x)=1\text{ when }x=2\pm\sqrt{10}$$
Since $f(x)$ is decreasing when $x<2$ and increasing when $x>2$, we get
$$f^{-1}[B]=[2-\sqrt{10},-1]\cup[5,2+\sqrt{10}]$$
