# Doubt in conditional hope. Uniform conditioned to a bernoulli

I'm having a hard time getting conditional hope. I know that $$P(X = x | Y = y) = y^x(1-y)^{1-x}, \:\: x = \{0,1\}, \:\: 0 \leq y \leq 1.$$ Besides that, $$Y \sim U[0, 1]$$.

I want to get $$E(Y|X=x).$$

Starting from the definition of conditional probability, I arrive at

\begin{align} P(Y = y | X = x) = & \frac{P(Y=y, X=x)}{P(X=x)}\\ & \frac{P(X=x|Y=y)P(Y=y)}{P(X=x)} \end{align}

Adding in $$Y$$ I get that $$X \sim Bern(0,5)$$. That way,

\begin{align} P(Y = y | X = x) = & \: \frac{P(X=x|Y=y)P(Y=y)}{P(X=x)}\\ = & \: \frac{y^x(1-y)^{1-x}yI(0 \leq y \leq 1)}{(\frac{1}{2})^x(\frac{1}{2})^{1-x}}\\ = & \: 2y^{x+1}(1-y)^{x-1}I(0 \leq y \leq 1) \end{align}

Where is the misconception, since for $$x = 0$$, $$Y|x=0$$ is not a density?

I think you have included an additional $$y$$ in the numerator and the index for $$(1-y)$$ seems to be not correct as well.
$$f_Y(y|X=x) = \frac{y^x(1-y)^{1-x}}{\frac12}=2y^x(1-y)^{1-x}$$
$$f_Y(y|X=0) = 2(1-y)$$ which is nonnegative and integrates to $$1$$.