In a class of 31 4 don't play sport. 17 play soccer and 18 play netball. How many only play netball and how many play both.

If x play both, then

17+18-x = 31-4

To find out how many students only play netball and how many play both soccer and netball, we can use set theory and Venn diagrams.

First, let's draw a Venn diagram representing the given information.

Let's denote the set of students who play soccer as A, the set of students who play netball as B, and the set of all students as U (universal set).

According to the information given:
- 4 students don't play any sport, so we can represent this as U - (A ∪ B).
- 17 students play soccer, which means they are part of set A.
- 18 students play netball, which means they are part of set B.

Now, let's calculate the number of students who only play netball.

To find this, we need to subtract the number of students who play both soccer and netball from the total number of students who play netball.

We know that:
|A| = 17 (number of students who play soccer),
|B| = 18 (number of students who play netball), and
|U - (A ∪ B)| = 4 (number of students who don't play any sport)

To find the number of students who play both soccer and netball, we can use the inclusion-exclusion principle:
|A ∩ B| = |A| + |B| - |U| = 17 + 18 - 31 = 4 (number of students who play both soccer and netball)

Therefore, to find the number of students who only play netball:
|B| - |A ∩ B| = 18 - 4 = 14

So, 14 students only play netball, and 4 students play both soccer and netball.