If you look closely at the Bilbo/goblin picture, it's fine, at least in the main rulebook. The goblin is pinned at the top and left by the wall. The picture in yours might be smaller and some detail may be is lost. Grab a magnifying glass
There is no way the goblin can move left, he's against the wall. There is no way the goblin can move down, there isn't enough space between the wall and Bilbo. There is no way he can move "right" he'd have to remain in contact with Bilbo until he clears the wall.
In a real game it's usually clear. The trapper will usually move their models to trap in an unequivocal way, and all you need for trap assurance is 3 hard points, whether they be models or terrain. Sometimes conditions change and models become un-trapped or trapped because of movement from previous fights.
If the situation is in doubt it's easiest to just be clear with your opponent about your intentions. I usually use these guidelines: if the attacker intended to trap (said so while moving and the defender agreed) and nothing has changed for that fight, then consider the model trapped. If the situation is unclear, roll a d6 and 4-6 means trapped.
EDIT: forgot: technically you don't have to move straight back, any direction is fine, but IMHO skittering 1mm around your opponent to move 1" and end up 1mm away behind him isn't sporting...