Suppose we have the following integral:
$$ L(q) = \int q(\theta) log\left( \frac{p(\theta,x)}{q(\theta)} \right) d \theta$$
Letting $q(\theta) = \prod_{i=1}^{K} q_{i}(\theta_{i})$, we have:
$$ L(q) = \int \prod_{i=1}^{K} q_{i}(\theta_{i}) log\left( \frac{p(\theta,x)}{\prod_{i=1}^{K} q_{i}(\theta_{i})} \right) d \theta$$
Expanding this, we get:
$$ L(q) = \int q_{j}(\theta_{j}) \left[ \int \prod_{i=1, i \neq j}^{K} q_{i}(\theta_{i}) log(p(\theta_{i}, x)) d\theta_{i} \right] d \theta_{j} - \int \prod_{i=1}^{K} q_{i}(\theta_{i}) \sum_{i=1}^{K} log(q_{i}(\theta_{i})) d\theta$$
Question 1:
The authors then let:
$$ log(\tilde{p}( \theta, x )) = \int \prod_{i=1, i \neq j}^{K} q_{i}(\theta_{i}) log(p(\theta_{i}, x)) d\theta_{i} + C$$
And they say
$$ L(q) = \int q_{j}(\theta_{j}) log(\tilde{p}( \theta, x )) d \theta_{j} - \int \prod_{i=1}^{K} q_{i}(\theta_{i}) \sum_{i=1}^{K} log(q_{i}(\theta_{i})) d\theta$$
The question here is: Where do they get the C from? Is it just because the integral is indefinite? But isn't that expression just the expectation of $log(p(\theta,x))$ over $\tilde{q}(\theta) = \prod_{i=1, i\neq j}^{K} q_{i}(\theta_{i})$?
Question 2
How do we expand the second part? The authors say:
$$ L(q) = \int q_{j}(\theta_{j}) \left[ \int \prod_{i=1, i \neq j}^{K} q_{i}(\theta_{i}) log(p(\theta_{i}, x)) d\theta_{i} \right] d \theta_{j} - \int q_{j}(\theta_{j}) log(q_{j}(\theta_{j})) d\theta_{j} + C$$
I understand that the C here is to account for all the other things not dependent on $q_{j}(\theta_{j})$.
I can expand and get:
$$ \int \prod_{i=1}^{K} q_{i}(\theta_{i}) \sum_{i=1}^{K} log(q_{i}(\theta_{i})) d\theta = \sum_{k=1}^{K} \prod_{i=1}^{K} q_{i}(\theta_{i}) log(q_{i}(\theta_{i})) d\theta_{i} $$
But how do we deal with the double summation over the same index? What is going on here? How did they get that $q_{j}(\theta_{j})$ term out and what is the full expansion actually?