Closed form solution