Let's use the principle of inclusion and exclusion to find the number of students who play both basketball and baseball.
Let A be the event that a student plays basketball (15 students), B be the event that a student plays baseball (16 students), and N be the event that a student plays neither sport (3 students). We want to find the number of students who play both sports, denoted by A ∩ B.
By the principle of inclusion and exclusion:
|A ∩ B| = |A| + |B| - |A ∪ B|
|A ∩ B| = 15 + 16 - 23
|A ∩ B| = 8
Therefore, there are 8 students who play both basketball and baseball.
Now, the probability that a student chosen randomly from the class plays both basketball and baseball is:
P(A ∩ B) = |A ∩ B| / |Total students|
P(A ∩ B) = 8 / 23
P(A ∩ B) ≈ 0.348
Therefore, the probability that a student chosen randomly from the class plays both basketball and baseball is approximately 0.348 or 34.8%.