The total number of petals Mabel has in her garden is 5 x 8 = <<5*8=40>>40 petals.
The total number of petals that Mabel gives to her teacher is 2 x 8 = <<2*8=16>>16 petals.
The total number of petals remaining in her garden is 40 - 16 = <<40-16=24>>24 petals.
#### 24