Problem statement,
In a graduating class of $236$ students, $142$ took algebra and $121$ took chemistry. What is the greatest possible number of students that could have taken both algebra and chemistry?
What I have so far,
$A \cup B = 263-x$ where ($x=A \cap B)$ where $A,B$ are students with algebra and chemistry respectively.
$y = $students with neither $A$ or $B$.
$$263 - x + y = 236$$
$$x = y - 27$$
Not sure how to proceed further.


We can define some value $a$ for students that didn't take algebra. We can see that $a=236-142=95$. Now this means that there are $94$ students who have only taken chemistry. The rest of those who've taken chemistry also took algebra, and let that value be $b$. So we can see that $b=121-94=27$.
This is the value you're looking for under the assumption that students have to take one at least one of these two classes. If they don't that then there is the answer Nuclear Hoagie already wrote.