Create a proposition using three variables We have the variables $p, q, r$.
Create a proposition $φ(p, q, r)→x$, using all three variables, that gives the result $x$. 
$x$ should be equal to $p$ if $q = 1$, and equal to $r$ if $q = 0$.
I have created $(p∧q)$ and $(r∧¬q)$.
Is this answer correct? $$φ(p, q, r) ≡ (p→(p∧q)⊻r→(r∧¬q))$$
 A: Not exactly since $\varphi(1,1,0)$ evaluates to $0$ instead of evaluating to $1$ as you desired. You can use the following method to find the expression you are looking for: 


*

*Build the truth table you want: $$\begin{array}{|c|c|}
\hline p & q & r & \varphi(p,q,r) \\\hline
1 & 1 & 1 & 1 \\\hline
1 & 1 & 0 & 1\\\hline
1 & 0 & 1 & 1\\\hline
1 & 0 & 0 & 0\\\hline
0 & 1 & 1 & 0\\\hline
0 & 1 & 0 & 0\\\hline
0 & 0 & 1 & 1\\\hline
0 & 0 & 0 & 0\\\hline
\end{array}$$

*Look for where $\varphi(p,q,r)$ evaluates to $1$; this happens at $\varphi(1,1,1)$, $\varphi(1,1,0)$, $\varphi(1,0,1)$, and $\varphi(0,0,1)$.

*Write $\varphi(1,1,1)$ as $pqr$, $\varphi(1,1,0)$ as $pq\bar{r}$, $\varphi(1,0,1)$ as $p\bar{q}r$, and $\varphi(0,0,1)$ as $\bar{p}\bar{q}r$.

*Take the sum of these products: $pqr$ + $pq\bar{r}$ + $p\bar{q}r$ + $\bar{p}\bar{q}r$.

*Rewrite + as $\lor$, concatenation as $\land$, and the overhead bar as $\lnot$.


The resulting expression is $(p \land q \land r) \lor (p \land q \land \lnot r) \lor  (p \land \lnot q \land r) \lor (\lnot p \land \lnot q \land r)$. You can use identities to simplify this in any way you want.
