In a certain Algebra 2 class of 21 students, 10 of them play basketball and 9 of them play baseball. There are 8 students who play neither sport. What is the probability that a student chosen randomly from the class plays both basketball and baseball?

Let A be the event that a student plays basketball, and B be the event that a student plays baseball. We want to find P(A and B), the probability that a student plays both basketball and baseball.

By the inclusion-exclusion principle, we have:

P(A or B) = P(A) + P(B) - P(A and B)

We know that P(A) = 10/21, P(B) = 9/21, and P(Neither) = 8/21, where "Neither" is the event that a student plays neither sport.

So,

P(A or B) = 10/21 + 9/21 - P(A and B)

P(A and B) = 1 - (10/21 + 9/21 - 8/21) = 10/21

Therefore, the probability that a student chosen randomly from the class plays both basketball and baseball is 10/21.