# Is P(x) = P(x | y )*P(y) + P(x | ~y )*P(~y) according to Bayes theorem?

#### sallu110

##### New Member
Can anyone tell me if this equation valid? If yes how? I have tried to check on google but couldn't find it! If this equation is valid then I will be able to solve a question on Bayes theorem. Thanks!

#### hlsmith

##### Less is more. Stay pure. Stay poor.
~y represent complement to y? Do you have a dataset to go along with this or could you create a toy set?

#### sallu110

##### New Member
~y represent complement to y? Do you have a dataset to go along with this or could you create a toy set?
Yes! ~y represents a complement to y!

#### hlsmith

##### Less is more. Stay pure. Stay poor.
Well let us see if you can beat me, but tomorrow I will make a toy example and see if the above holds.

#### Dason

It does. Definition of conditional probability and law of total probability. Maybe need one other piece but yeah it works

#### hlsmith

##### Less is more. Stay pure. Stay poor.
Dummy me just did it by hand and they were equal.

2x2 matrix: 10, 12, 15, 20.
p(x) = (22/57) = ((10/25) * (25/57)) + ((12/32) * (32/57))
0.386 = 0.386