If $X$ is $\sigma(\mathcal{G} \cup \mathcal{H})$-measurable can we write $X=f(G,H)$? Let $(\Omega, \mathcal{F}, P)$ be a probability triplet.  Let $\mathcal{G}$ and $\mathcal{H}$ be two sub-sigma-algebras of $\mathcal{F}$. Let $X:\Omega\rightarrow\mathbb{R}$ be a random variable such that
$\sigma(X) \subseteq \sigma(\mathcal{G} \cup \mathcal{H})$.
Can we say there is a Borel-measurable function $f:\mathbb{R}^2\rightarrow\mathbb{R}$ and two random variables $G$ and $H$ such that
$X = f(G,H)$, and $\sigma(G) \subseteq \mathcal{G}$, $\sigma(H) \subseteq \mathcal{H}$?  Are there references where I can cite such a result?
If it makes the problem easier, I am also interested in the case when $\mathcal{G}$ and $\mathcal{H}$ are independent and/or when one of the sub-sigma-algebras, say $\mathcal{G}$, is generated by some random variable $R$.

Note 1: I can show it is true if there are random variables $R, S$ such that $\mathcal{G}=\sigma(R)$ and $\mathcal{H}=\sigma(S)$.
Note 2: There may be some hope by applying properties of countably generated sigma algebras, since $\sigma(X)$ is countably generated. If we define the events $B_x = \{X \leq x\}$ for each rational number $x$, I wonder if there is a way of writing a particular event $B_x$ in terms of events in $\mathcal{G}$ and $\mathcal{H}$.

Application: I have a random variable $Z$ and I want to write for some $f$:
$$ E[Z|\sigma(\mathcal{G} \cup \mathcal{H})] \overset{?}{=} f(G,H)$$
This is similar in spirit to the known fact $E[Z|\sigma(Y)]=f(Y)$ for some $f$.
 A: What is true, and this may be sufficient for your purposes, is that under the stated conditions there is a $\mathcal G\otimes\mathcal H$-measurable map $Z:\Omega\times\Omega\to\Bbb R$ such that $X(\omega) = Z(\omega,\omega)$ for all $\omega\in\Omega$. (And conversely, because  $\omega\mapsto(\omega,\omega)$ is $\sigma(\mathcal G\cup\mathcal H)/\mathcal G\otimes\mathcal H$-measurable.)
A: This answer fills in details of the John Dawkins answer (which gave no proof) and comments (which gave a proof sketch). I ended up changing things to extended-real-valued functions to ensure the proof steps work.
Setup
We have a probability triplet $(\Omega, \mathcal{F}, \mathbb{R})$. We have $\mathcal{G}, \mathcal{H}$ that are sub-sigma-algebras of $\mathcal{F}$, we have a random variable  $X:\Omega\rightarrow\mathbb{R}$ such that $\sigma(X) \subseteq \sigma(\mathcal{G} \cup \mathcal{H})$.
Define the extended real numbers:
$$ \mathbb{E} = \mathbb{R} \cup \{\infty\} \cup \{-\infty\}$$
Claim
There is a $\sigma(\mathcal{G}\otimes \mathcal{H})$-measurable function $Z:\Omega^2\rightarrow \mathbb{E}$ such that $X(\omega)=Z(\omega,\omega)$ for all $\omega \in \Omega$.
Proof:
We will prove for the special case of $X$ bounded.  The boundedness assumption can be removed as described by comments to John's answer.

I use this link to "Analysis Tools with Examples" by B. K. Driver:
http://www.math.ucsd.edu/~bdriver/DRIVER/Book/anal.pdf
Theorem 11.2 states this:
Let $\Omega$ be a nonempty set. Let $\mathbb{H}$ be a vector subspace of bounded functions $X:\Omega\rightarrow\mathbb{R}$. Assume

*

*$\mathbb{H}$ contains all constant functions.


*$\mathbb{H}$ is a vector subspace:  If $X, Y \in \mathbb{H}$ and $a,b\in \mathbb{R}$ then $aX+bY \in \mathbb{H}$.


*If $\{X_n\}_{n=1}^{\infty}$ is a sequence of functions in $\mathbb{H}$ such that there is an $M<\infty$ such that:



*

*$|X_n(\omega)|\leq M$ for all $\omega \in \Omega$ and $n \in \{1, 2 ,3,...\}$.


*$\lim_{n\rightarrow\infty} X_n(\omega) = X(\omega)$ for all $\omega \in \Omega$, for some function $X:\Omega\rightarrow\mathbb{R}$.
Then $X \in \mathbb{H}$.


*There is some "multiplicative system" $\mathbb{M}$ such that $\mathbb{M} \subseteq \mathbb{H}$.  Specifically, $\mathbb{M}$ is a multiplicative system if $X \in \mathbb{M}$ and $Y \in \mathbb{M}$ imply $XY \in \mathbb{M}$.

Then $\mathbb{H}$ contains all bounded and $\sigma(\mathbb{M})$-measurable functions.

Notational note:  If $\mathbb{M}$ is a set of functions $X:\Omega\rightarrow\mathbb{R}$ then $\sigma(\mathbb{M})$ is defined
$$ \sigma(\mathbb{M}) = \sigma(\cup_{X \in \mathbb{M}} \sigma(X))$$
where $\sigma(X)$ is the sigma algebra generated by  $X:\Omega\rightarrow\mathbb{R}$.

Following John's suggestions (modifying them to extended real-valued functions):  Define $\mathbb{H}$ as the set of all bounded functions $Y:\Omega\rightarrow\mathbb{R}$ such that $\sigma(Y) \subseteq \sigma(\mathcal{G} \cup \mathcal{H})$ and $Y(\omega) = Z(\omega,\omega)$ for all $\omega \in \Omega$, where $Z:\Omega^2 \rightarrow\mathbb{E}$ is some function that satisfies $\sigma(Z) \subseteq \mathcal{F} \otimes \mathcal{G}$. Let us first show this satisfies the requirements of Theorem 11.2:

*

*Indeed $\mathbb{H}$ contains all constant functions: Fix $c \in \mathbb{R}$. If $Y:\Omega\rightarrow\mathbb{R}$ is defined by $Y(\omega) = c$ for all $\omega \in \Omega$ then $\sigma(Y) = \{\Omega, \phi\} \subseteq \sigma(\mathcal{G} \cup \mathcal{H})$.  And we can write $Y(\omega) = Z(\omega, \omega)$ for $Z:\Omega^2\rightarrow\mathbb{R}$ defined by $Z(\omega, v) = c$ for all $(\omega, v) \in \Omega^2$, and indeed $\sigma(Z) \subseteq \mathcal{F} \otimes \mathcal{G}$.


*Indeed $\mathbb{H}$ is a vector space.


*Suppose $M$ is a constant and $\{X_n\}_{n=1}^{\infty}$ is a sequence of functions in $\mathbb{H}$ that satisfy $|X_n(\omega)|\leq M$ for all $n \in \{1, 2, 3, ...\}$ and all $\omega \in \Omega$. Suppose there is a function $X:\Omega\rightarrow\mathbb{R}$ such that $X_n(\omega)\rightarrow X(\omega)$ for all $\omega \in \Omega$.  We want to show $X \in \mathbb{H}$.  Since all $X_n$ functions are uniformly bounded by $M$, the limit function $X$ must be uniformly bounded by $M$. Next, we know the pointwise limit of $\sigma(\mathcal{G} \cup \mathcal{H})$-measurable functions is also $\sigma(\mathcal{G} \cup \mathcal{H})$-measurable, so $X$ is $\sigma(\mathcal{G} \cup \mathcal{H})$-measurable.  Finally, we know for each $n$ that $X_n(\omega) = Z_n(\omega, \omega)$ for some $(\mathcal{G}\otimes \mathcal{H})$-measurable functions $Z_n:\Omega^2\rightarrow\mathbb{E}$. There is a theorem that says the function $\limsup_{n\rightarrow\infty} Z_n(\omega,v)$ is an extended real-valued function that is also $(\mathcal{G}\otimes \mathcal{H})$-measurable.  And of course $X(\omega) = \limsup_{n\rightarrow\infty} Z_n(\omega, \omega)$ for all $\omega \in \Omega$.


*Let $\mathbb{M}$ be the set of all bounded functions $X:\Omega\rightarrow\mathbb{R}$ such that $X(\omega) = G(\omega)H(\omega)$ for some $\mathcal{G}$-measurable function $G:\Omega\rightarrow\mathbb{R}$ and some $\mathcal{H}$-measurable function $H:\Omega\rightarrow\mathbb{R}$.Then $\mathbb{M}$ is a multiplicative system because the product of $\mathcal{G}$-measurable functions is $\mathcal{G}$-measurable and the product of $\mathcal{H}$-measurable functions is $\mathcal{H}$-measurable.
From Theorem 11.2 we conclude that $\mathbb{H}$ contains all bounded $\sigma(\mathbb{M})$-measurable functions.

We now require to prove that $\sigma(\mathcal{G} \cup \mathcal{H}) \subseteq \sigma(\mathbb{M})$.  This would imply that our bounded random variable $X$ is $\sigma(\mathbb{M})$-measurable and so $X \in \mathbb{H}$, meaning that $X(\omega) = Z(\omega, \omega)$ for some $(\mathcal{G}\otimes\mathcal{H})$-measurable function $Z:\Omega^2\rightarrow\mathbb{E}$.
Take any set $A \in \mathcal{G}$.  Define $G=1_A$ and $H=1$.  Then $X=GH = 1_A$ is in $\mathbb{M}$. So $\sigma(X) \subseteq \sigma(\mathbb{M})$ and so $A \in \sigma(\mathbb{M})$.  Similarly if $B \in \mathcal{H}$ then $B \in \sigma(\mathbb{M})$.  Thus $\mathcal{G} \subseteq \sigma(\mathbb{M})$ and $\mathcal{H} \subseteq \sigma(\mathbb{M})$ and so $\sigma(\mathcal{G} \cup \mathcal{H}) \subseteq \sigma(\mathbb{M})$.
$\Box$
