The best approach to this problem is using a Venn Diagram. The first step to solving this problem is calculating the number of students who study Spanish or German or both. In the question we are given the information that 12 students study neither German nor Spanish, so we can subtract this number from the total number of students. This leaves us with (57-12) 45 students who study Spanish or German or both.
The second step is we need to calculate how many students have been counted twice (which is denoted by the intersection of the Venn Diagram). To calculate this we add the number of students studying Spanish to the number of students studying German and subtract the total number of students who study Spanish or German or both. This gives us (32+40-45) 27 students who study both German and Spanish. To complete the problem all we have to do is complete the Venn Diagram. We know that 32 students study Spanish so (32-27) 5 students study Spanish and not German. Similarly we know that (40-27) 13 students study German and not Spanish. Therefore the answer is 5 students.
To check the answer we add all numbers in the Venn Diagram to ensure they equal 57. (12+27+5+13=57 )