Artificial intelligent assistant

What is the probability that this person really has the disease? A test for a certain disease has a probability $\frac{4}{5}$ of detecting the disease when it ispresent and a probability of $\frac{1}{10}$ of falsely \detecting" it when it is not present. The proportion of people afflicted by the disease for a given population is 15%. If a person from the population is randomly selected and gives a positive result to the test, what is the probability that this person really has the disease? (Answer: 24/41). I'm struggling to get that answer. I honestly just don't know how to approach this question.

Let $D$ and $\
eg D$ represent the events that the patient has and does not have the disease respectively, and let $T$ and $\
eg T$ represent the event that the test is positive or negative respectively.

What do we want to compute?

> $P(D \mid T)$

Unfortunately, all of our probabilities are in the form "test is (pos/neg) given patient (has/doesn't have) disease," which is "backwards" of what we want to compute. Bayes's Rule to the rescue!

> \begin{align*}P(D \mid T) &= \frac{P(D \cap T)}{P(T)}\\\ &= \frac{P(T \mid D) P(D)}{P(T)} \\\&= \frac{P(T \mid D) P(D)}{P(T \mid D)P(D) + P(T \mid \
eg D)P(\
eg D)} \end{align*}

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 0ea1b4264f16ac8cf3564ca64d67d7d9