Kid shouldn't have beaked off (though teens do that all the time), definitely should not have thrown a basketball at the guy. The teacher should have had enough self control not to escalate and absolutely should not have thrown the first punch - that part's simply inexcusable.
From a pure legal standpoint, the teacher definitely committed assault, and you could make a pretty good case for bringing the kid up on charges too for throwing the basketball. I'd probably split the blame 60/40 with the greater share going to the teacher. Kids can be infuriating little shits at times, but if you're an adult you absolutely have to have enough self control not to haul off and punch one of them, especially if you're an educator or other caregiver.