Let $A=(2,0)$ and $B=(1,1)$ be points in a plane and let $R$ be the region surrounded by the triangle $OAB$ (of area 1). Let $P$ be point in $R$ which is distributed uniformly. Setting $X$ and $Y$ be the $x$ and $y$ coordinate of $P$, respectively, we may set
$$f_{XY}(x,y)=1\qquad(0\le y\le x, y\le 2-x)$$
What is $E[X|Y=y]$?
Intuitively, it should be $1$, since the interval of $X$ is centered at $1$, regardless of the value of $y$.
But, I can't solve it using computation ;

Keep in mind that $y$ is a fixed number($0\lt y\lt 1$). Since $x$ ranges from $y$ to $2-y$,
$$E[X|Y=y]=\int_y^{2-y}xf(x)\,dx$$
Here, $f(x)$ is a PDF of uniform distribution on $[y,2-y]$, for which
$$f(x)=\frac1{2-2y}.$$
Thus,
\begin{align*} E[X|Y=y] &=\int_y^{2-y}\frac x{2-2y}\,dx\\ &=\frac1{2-2y}\int_y^{2-y} x\,dx\\ &=\frac1{2-2y}\times\frac12\times\left((2-y)^2-y^2\right)\\ &=1. \end{align*}
The function $f(x)$ can be obtained by
\begin{align*} f_{X|Y}(x,y) &=\frac{f_{XY}(x,y)}{f_Y(y)}\\ &=\frac1{\int_y^{2-y} f_{XY}(x,y)\,dx}\\ &=\frac1{(2-y)-y}\\ &=\frac1{2-2y} \end{align*}