To find the probability that a randomly chosen student takes both Algebra 2 and Chemistry, we can use the principle of inclusion-exclusion to find the number of students who take at least one of the subjects.
- Total number of students: 325
- Students taking Algebra 2: 190
- Students taking Chemistry: 165
- Students taking neither: 40
First, we find the number of students who take at least one of the subjects:
\[ \text{Students taking at least one subject} = \text{Total students} - \text{Students taking neither} \]
\[ = 325 - 40 = 285 \]
Now, using the principle of inclusion-exclusion, we can express the number of students taking at least one subject:
\[ n(A \cup B) = n(A) + n(B) - n(A \cap B) \]
where:
- \( n(A) \) is the number of students taking Algebra 2 (190)
- \( n(B) \) is the number of students taking Chemistry (165)
- \( n(A \cup B) \) is the number of students taking at least one of the subjects (285)
- \( n(A \cap B) \) is the number of students taking both subjects (which we want to find)
Substituting the known values into the inclusion-exclusion formula gives us:
\[ 285 = 190 + 165 - n(A \cap B) \]
Simplifying this:
\[ 285 = 355 - n(A \cap B) \]
Rearranging gives:
\[ n(A \cap B) = 355 - 285 = 70 \]
So, 70 students take both Algebra 2 and Chemistry.
Finally, we want to find the probability that a randomly chosen student takes both subjects:
\[ P(A \cap B) = \frac{n(A \cap B)}{\text{Total students}} = \frac{70}{325} \]
Now, we simplify \( \frac{70}{325} \):
Both 70 and 325 can be divided by 5:
\[ \frac{70 \div 5}{325 \div 5} = \frac{14}{65} \]
Thus, the probability that a student chosen randomly from the junior class takes both Algebra 2 and Chemistry is:
\[ \boxed{\frac{14}{65}} \]