The Question:
Assume that the chances of a patient having a heart attack is 40%. It is also assumed that a meditation and yoga course reduce the risk of heart attack by 30% and prescription of certain drug reduces its chances by 25%. At a time a patient can choose any one of the two options with equal probabilities. It is given that after going through one of the two options the patient selected at random suffers a heart attack. Find the probability that the patient followed a course of meditation and yoga?
The official solution given is this:
Let $$A: \text{Person suffers a heart attack}$$ $$E_{1}: \text{Person follows a course on Meditation & Yoga}$$ $$E_{2}: \text{Person is treated with drug}$$
Given,
- $\Pr(A)= 0.4$
- $\Pr(A|E_{1}) = 0.4 * 0.7 = 0.28$
- $\Pr(A|E_{2}) = 0.4 * 0.75 = 0.3$
Also given that meditation & yoga and drug prescription has equal probabilities i.e., $\Pr(E_{1}) = \Pr(E_{2}) = 0.5$
We have to find the probability a person followed a course on meditation & yoga given that he suffered a heart attack i.e., $\Pr(E_{1}|A)$ Using Bayes' Theorem, $$\Pr(E_{1}|A) = \frac{\Pr(E_{1})*\Pr(A|E_{1})}{\Pr(E_{1})*\Pr(A|E_{1})+\Pr(E_{2})*\Pr(A|E_{2})}$$ Substituting values, we get $$\boxed{\Pr(E_{1}|A) = \frac{14}{29}}$$
When I first looked at the question, this is how I solved it:
From Bayes' Theorem, we know that $$\Pr(E_{1}|A) = \frac{\Pr(E_{1})*\Pr(A|E_{1})}{\Pr(A)}$$
Now I substituted the values to get $\Pr(E_{1}|A) = \frac{7}{20}$. Note that I used $\Pr(A) = 0.4$ (and here is where I think the mistake lies).
I then drew this diagram to visualise what I was doing:
So looking at the image, this where I think I went wrong:
When I take $\Pr(A) = 0.4$, I also include the people who did not suffer a heart attack because they took the medication (aka those who benefited from the course\drug prescription).
In the official solution, they ignored the unshaded part of the left $0.4 * 1$ rectangle (in my diagram) because they did not suffer a heart attack. Am I right? If no, where am I going wrong?

If in this context a patient has probability $0.5$ to undergo a course in Meditation/Yoga and has probability $0.5$ to be treated with a drug then:$$P(A)=P(A\mid E_1)P(E_1)+P(A\mid E_2)P(E_2)=0.28\times0.5+0.3\times0.5=0.29$$where $A$ denotes the event that the patient will get a heart attack.
Further we have the equality:$$P(E_1\mid A)P(A)=P(A\cap E_1)=P(A\mid E_1)P(E_1)$$
Substituting $P(A)$, $P(E_1)$ and $P(A\mid E_1)$ we find:$$P(E_1\mid A)\times0.29=0.28\times0.5$$and conclude that:$$P(E_1\mid A)=\frac{14}{29}$$
The conditional probabilities $P(A\mid E_i)$ are deduced from the data.