Upon examining the contents of 38 backpacks, it was found that 23 contained a black pen, 27 contained a blue pen, and 21 contained a pencil, 15 contained both a black pen and a blue pen, 12 contained both a black pen and a pencil, 18 contained both a blue pen and a pencil, and 10 contained all three items. How many backpacks contained none of the three writing instruments?

To determine the number of backpacks that contained none of the three writing instruments, we need to use the principle of inclusion-exclusion.

Let's break down the information given:

- The number of backpacks containing a black pen (23) and the number containing a blue pen (27) do not include any overlap yet.
- The number of backpacks containing a pencil (21) is separate from the other two categories.

Now, to count the number of backpacks that contain both a black pen and a blue pen, we have 15.

Next, let's calculate the number of backpacks that contain both a black pen and a pencil, which is 12.

Similarly, the number of backpacks that contain both a blue pen and a pencil is 18.

Lastly, there are 10 backpacks that contain all three writing instruments.

To find the number of backpacks that contain none of the three writing instruments, we need to subtract the total number of backpacks that contain any writing instrument from the total number of backpacks.

Total number of backpacks = 38

Backpacks containing a black pen = 23
Backpacks containing a blue pen = 27
Backpacks containing a pencil = 21

Backpacks containing both a black pen and a blue pen = 15
Backpacks containing both a black pen and a pencil = 12
Backpacks containing both a blue pen and a pencil = 18

Backpacks containing all three writing instruments = 10

To calculate the number of backpacks containing none of the three writing instruments, use the formula:

Total number of backpacks - (Backpacks containing a black pen + Backpacks containing a blue pen + Backpacks containing a pencil - (Backpacks containing both a black pen and a blue pen + Backpacks containing both a black pen and a pencil + Backpacks containing both a blue pen and a pencil) + Backpacks containing all three writing instruments)

Substituting the values:

38 - (23 + 27 + 21 - (15 + 12 + 18) + 10)

Simplifying:

38 - (71 - 45 + 10)
38 - (71 - 55)
38 - 16

Therefore, the number of backpacks containing none of the three writing instruments is 22.