Let us consider a set of linear models defined by the function $Y_i = \beta X_i + \epsilon_i, \epsilon_i \sim N(0,\sigma^2).$ Take a model $S$, and define the training error of a given model as $\hat{R}_\text{tr}(S) = \sum_{i=1}^n (\hat{Y}_i(S) - Y_i)^2.$ We define Mallow's $C_p$ statistic as $$\hat{R}(S) = \hat{R}_\text{tr}(S) + 2|S|\hat{\sigma}^2,$$
where $|S|$ denotes the number of terms in the model $S$ and $\hat{\sigma}^2$ is the estimate of $\sigma^2$ obtained for the full model. Consider the AIC function of a model to be $AIC(S) = l_S - |S|,$ where $l_S$ is the log-likelihood of the model evaluated at the MLE.
I would like to show that, given $\sigma$ as known, that $\arg\max_S AIC(S) = \arg\min_S \hat{R}(S).$ I was having some trouble showing this statement using general unconstrained optimization, in particular because I am not entirely sure how to handle the derivative of the function for Mallow's $C_p$ given that we have $|S|$ in the second term of that function. Is there a better way to show this particular statement?