Optimal taxation in an endogenous growth model with variable population and public expenditure