The purpose of the wall has been endlessly debated, which seems surprising. One would think it obvious that the goal was to keep the northern tribes from attacking territory controlled by the Empire, but there are those that have argued that the tribes didn’t pose enough of a threat to justify the enormous expense of building the structure. The true answer may be as simple as Hadrian employing his "defense before expansion" strategy or perhaps he simply decided to draw a line where the Empire in Britain would end.
Still, it is clear that the wall was built as a defensive structure. Examine the following graphic, provided to me by Geoff Carter, which demonstrates how the wall was designed to facilitate a counterattack against invaders.