Tan(x) = sin(x) / cos(x). Therefore, tan(x) pi/2 = 1/0, which doesn't exist. Imagine that, instead of 0, it's a number incredibly close to 0. The smaller the number in the denominator, the bigger the outcome. Therefore, we can think of 1/0 as infinity, or approaching infinity as one gets closer to 1/0. This is the same result approaching from the negative side, only it's negative infinity. If x=0, it's 0/1 instead (sin 0=0, cos 0=1). Anything divided by 1 is itself, so as x approaches 0, so does f(x).