# Why are logarithms used in GANs minimax equation?

The minimax equation for generative adversarial networks

$$\min_G \max_D V(D,G) = \mathbb{E}_{\boldsymbol{x}\sim p_{data}(\boldsymbol{x})}[\log D(\boldsymbol{x})] + \mathbb{E}_{\boldsymbol{z}\sim p_{\boldsymbol{z}}(\boldsymbol{z})}[\log(1 - D(G(\boldsymbol{z}))]$$

Why do we use logarithms instead of just

$$\min_G \max_D V(D,G) = \mathbb{E}_{\boldsymbol{x}\sim p_{data}(\boldsymbol{x})}[ D(\boldsymbol{x})] + \mathbb{E}_{\boldsymbol{z}\sim p_{\boldsymbol{z}}(\boldsymbol{z})}[(1 - D(G(\boldsymbol{z}))]$$

It's common in machine learning to do this log-trick, i.e. rather than optimizing $$f(\mathbf{x})$$, you optimize $$\log f(\mathbf{x})$$.
1. When your objective function is the product of multiple probabilities (or, more generally, small numbers), i.e. $$f(\mathbf{x}) = \prod_{i=1}^N p(x_i)$$, then $$\log f(\mathbf{x}) = \log \left( \prod_{i=1}^N p(x_i) \right) = \sum_{i=1}^N \log p(x_i)$$ (see this), which is more numerical stable because we got rid of multiplication of possibly very small numbers, which can lead to underflow.
3. The logarithm is monotonically increasing, so $$\log f(\mathbf{x})$$ has the same optima as $$f(\mathbf{x})$$ (simple proof here).