# Marginal derivation from joint pdf

I have a uniform prior f(Θ) ~ U(4,10) and a uniform 'observation' model f(X|Θ) ~ U(θ-1, θ+1). Their joint pdf is f(X,Θ)=1/12 for 4 < θ < 10 and (θ-1)< x <(θ+1)  and 0 otherwise.

If I compute the marginal f(Θ) as the integral of joint over x (from x=3 to x=11), the answer I get is 1/4. But this is not even a pdf since the area under the curve is not 1.

Samewise, the marginal f(x) is 1/2 but again this is not correct. Am I doing something wrong in the integral bounds?

Also, if the marginal f(X) is uniform that means that eg. x=3(that can happen only for θ=4) has the same probability to occur as x=7 (that can happen for θ=6, θ=7, θ=8). Does that make sense? I got confused in general..

For $$f(\theta)$$, you fix the $$\theta$$ and integrate the joint $$\forall x$$: $$f(\theta)=\int_{-\infty}^\infty f(x,\theta)dx=\int_{\theta-1}^{\theta+1}\frac{1}{12}dx=\frac{1}{6}$$ Here the limits are chosen for each fixed $$\theta$$. For a given $$\theta$$, joint PDF is non-zero only in $$[\theta-1,\theta+1]$$. For visualizing this, draw a line for an arbitrary $$\theta$$ value, say $$\theta=5$$, and note the intersection points of the line with the joint PDF's area of support.
For $$f(x)$$, you fix $$x$$ and try to formulate where the joint is non-zero. For example, for $$3\leq x\leq 5$$, the integral bounds for $$\theta$$ are from $$4$$ to $$x+1$$, which is the y-value of the intersection point of the vertical line (for some $$x$$ in $$[3,5]$$) and the line passing through points $$(3,4)$$, $$(9,10)$$, i.e. $$\theta=x+1$$. You'll need to consider three regions for $$x$$, and the resulting PDF won't be uniform.