we know that due to the Weierstrass approximation theorem. if we have a nonnegative function $f:[a,b] \to \mathbb{R}$ and f is continuous and $\int_{a}^{b}f(x)dx=0$, then we will have $f=0$ on $[a,b].$
Now I have a slightly different one. Suppose we have a non-negative continous function $f(x,y)$ defined on $[a,b] \times [c,d] \to \mathbb{R} $ and we have $\int_{c}^{d}f(x,y)dy=1$, for all $x \in [a,b].$ Can I prove that $f(x,y)$ is just a function of $y$ on $[c, d]$?
Obvious the non-negativity is important, otherwise I can choose $f(x,y)=xy+\frac{3}{2}y^2$ and $[c,d]=[-1,1].$ Then $\int_{c}^{d}f(x,y)dy=1$. But $f(x,y)$ is not just a function of $y$. Can somebody help me with this? What I think is that we can use a similar approach to the Weierstrass approximation theorem. But I can not figure out how to do it. If we add more condition (like $f(x,y)$ is $C^{\infty}$). It seems like it didn't help.
$[a,b]=[-\frac1 2, \frac 1 2], [c,d]=[-1,1]$ and $f(x,y)=\frac 1 2+xy$ is a counter-example.