# Guessing the length of a fish

I would like to solve the following excercise. Any help is appreciated.

90% of the fish in our pond are males, the rest are females.

The length of the males are:

$X+5$ inches, where $X\sim exp(1)$

The length of the females are:

$Y+8$ inches, where $Y \sim exp(2)$

What is the probability that a fish whose length is $x$ is male, and how can we guess the sex of the fish from their length if we want that our guess is right with the biggest possible probability?

This is a classic exercise of conditional probability. The most important thing is to get right what how to write the question of the exercise. In this case, we want the probability of a fish whose length is x being male. The first thing is to write down this probability, which is conditional: is the probability of being male GIVEN THAT the length is x, then we want to compute $$P(male|x)$$ to do that now we use Bayes Theorem: $$P(male|x)=\frac{P(x|male)P(male)}{P(x)}$$ we do this because in this way we can use information that we have in the problem statement, like $P(male)$ and $P(x|male)$ (the exponential distribution). The only left thing is $P(x)$, which should be computed using law of total probability, $$P(x)=P(x|male)P(male)+P(x|female)P(female)$$