Suppose that in answering a question on a true/false test, an examinee either knows the answer with probability $p$ or s/he guesses with probability $1-p$. Assume that if the examinee knows the answer to a question, the probability that s/he gives the correct answer is $1$, and if s/he guesses then s/he only gives the correct answer with probability $0.5$.
Use Bayes rule to compute the probability that an examinee knew the answer to a question given that s/he has correctly answered it.
First I wrote out all the probabilities from the question.
$$ P(\text{Wrong}) = 0.5 \\ P(\text{Correct}) = 0.5 \\ P(\text{Correct} \mid \text{Known}) = 1 \\ P(\text{Wrong} \mid \text{Known}) = 0 \\ P(\text{Correct} \mid \text{Guess}) = 0.5 \\ P(\text{Wrong} \mid \text{Guess}) = 0.5 \\ $$ I tried creating two equations with two unknowns to get a value of $p$ shown below:
$$ (1)\quad 0.5 = \frac{P(\text{Guess} \mid \text{Correct})\cdot0.5}{1 - p} $$
$$ (2)\quad 1 = \frac{P(\text{Known} \mid \text{Correct})\cdot0.5}{p} $$
Then rearranged $(2)$ to get the following:
$$ P(\text{Known} \mid \text{Correct}) = 2p $$
And $P(\text{Guesses} \mid \text{Correct})$ is equal to $1 - P(\text{Knows} \mid \text{Correct})$ so I substituted that back into $(1)$
$$ (1)\quad 0.5 = \frac{(1 - 2p)\cdot0.5}{1 - p}\\ (1)\quad 0.5 = \frac{0.5 - p}{1 - p}\\ (1)\quad 0.5 - 0.5p = 0.5 - p\\ 0.5p = 0\\ p = 0 $$
But this is can't be right, the question is only 5% so doesn't seem like it would be this much work, am I missing something simple here? The main equation that needs to be solved:
$$ P(\text{Known} \mid \text{Correct}) = \frac{P(\text{Correct} \mid \text{Known}) P(\text{Known})}{P(\text{Correct})} $$
Let's write the question out:
$$ \mathcal{P}(\text{Knows the answer}) = p \qquad \mathcal{P}(\text{Doesn't know the answer}) = 1-p$$
And
$$ \mathcal{P}(\text{Correct} | \text{Knows the answer}) = 1; \;\mathcal{P}(\text{Wrong} | \text{Knows the answer}) = 0$$
$$ \mathcal{P}(\text{Correct} | \text{Doesn't know the answer}) = 0.5; \;\mathcal{P}(\text{Wrong} | \text{Doesn't know the answer}) = 0.5$$
\par The question is to find: $$\mathcal{P}(\text{Knows the answer} | \text{Correct}) = ? $$
Using Bayes, one finds: $$\begin{align}\mathcal{P}(\text{Knows the answer} | \text{Correct}) &= \dfrac{\mathcal{P}(\text{Correct} | \text{Knows the answer})\mathcal{P}(\text{Knows the answer)} }{\mathcal{P}(\text{Correct})} \\ &= \dfrac{1\cdot p}{\mathcal{P}(\text{Correct})} \end{align}$$
Now using the law of total probability, $$\begin{align}\mathcal{P}(\text{Correct}) &= \mathcal{P}(\text{Correct} | \text{Knows the answer})\cdot \mathcal{P}(\text{Knows the answer}) \\ &+\mathcal{P}(\text{Correct} | \text{Doesn't know the answer})\cdot \mathcal{P}(\text{Doesn't know the answer})\\ & = 1\cdot p+0.5\cdot (1-p) \\ & = 0.5p +0.5 \end{align}$$
Which implies: $$\begin{align}\mathcal{P}(\text{Knows the answer} | \text{Correct}) &= \dfrac{p}{0.5p+0.5} \end{align}$$
Notice how when $p=1$ (which implies the examinee knows the answer all the time) then this probability also equals 1. (which makes sense)
To visualize this probability in function of $p$, see the following graph: