I am not sure if this is correct but I vaguely recall the professor mentioned something like this in class: Let $(\Omega, \mathcal{F}, \mathbb{P})$ be a probability space, and $X, Y_{1}, ..., Y_{n}$ random variables on it. Let $\sigma(Y_{1}, ..., Y_{n})$ be the sigma algebra generated by $Y_{1}, ..., Y_{n}$. Then $X$ is $\sigma(Y_{1}, ..., Y_{n})$-measurable iff $X = H(Y_{1}, ..., Y_{n})$ for some $H$ measurable.
Could someone explain the hard direction?