One morning Tracey leaves her house and realises that her grass is wet. Is it due to overnight rain or did she forget to turn off the sprinkler last night? Next she notices that the grass of her neighbour, Jack, is also wet.
Let $R\in\{0,1\}$ ($R=1$ means that it has been raining)
$S\in\{0,1\}$ ($S=1$ means that Tracey has forgotten to turn off the sprinkler)
$J\in \{0,1\}$ ($J=1$ means that Jack's grass is wet)
$T\in\{0,1\}$ ($T=1$ means that Tracey's Grass is wet)
The distribution is the following:
$$P(T,J,R,S)=P(T|R,S)P(J|R)P(R)P(S)$$
$P(R=1)=0.2,\\P(S=1)=0.1,\\ P(J=1|R=1)=1,\\ P(J=1|R=0)=0.2,\\ P(T=1|R=1,S)=1,\\P(T=1|R=0,S=1)=0.9,\\P(T=1|R=0,S=0)=0$
The textbook writes out the following solution to find $P(S=1|T=1)$:
$$P(S=1|T=1)=\frac{P(S=1,T=1)}{P(T=1)}=\frac{\sum_{J,R}P(T=1,J,R,S=1)}{\sum_{J,R,S}P(T=1,J,R,S)}\\=\frac{\sum_{J,R}P(J|R)P(T=1|R,S=1)P(R)P(S=1)}{\sum_{J,R,S}P(J|R)P(T=1|R,S)P(R)P(S)}\\=\frac{\sum_RP(T=1|R,S=1)P(R)P(S=1)}{\sum_{R,S}P(T=1|R,S)P(R)P(S)}$$
I don't understand how do they get rid of/cancel out the subscript $J$ in the last expression. I tried writing it out both the numerator and the denominator of the expression before the last one:
$$\sum_{J,R}P(J|R)P(T=1|R,S=1)P(R)P(S=1)\\=\sum_R\left(P(J=1|R)P(T=1|R,S=1)P(R)P(S=1)+P(J=0|R)P(T=1|R,S=1)P(R)P(S=1)\right)$$
And the denominator:
$$\sum_{J,R,S}P(J|R)P(T=1|R,S)P(R)P(S)\\=\sum_{R,S}\left(P(J=1|R)P(T=1|R,S)P(R)P(S)+P(J=1|R)P(T=1|R,S)P(R)P(S)\right)$$
Not sure how they cancel out.