# Invariance of MLE

Random sample has pdf:$f(x|\theta)$
Then the MLE of $\theta$ is $$\hat{\theta}=\arg\max_{ \theta}\sum_{i=1}^n\log f(x_i|\theta)$$

$\tau=g(\theta)$

My question is why $\tau$ 's MLE is $$\hat{\tau}=\arg \max_\tau\left[\max_{\theta\in g^{-1}(\tau)}\sum_{i=1}^n\log f(x_i|\theta) \right]$$