double latitude = (Math.PI / 2) - (2 * Math.Atan(Math.Exp(-1.0 * y / wgs84EarthRadius)));
var y = -wgs84EarthRadius * Math.Log(Math.Tan((Math.PI / 2 - latitude)/2.0));
Then knowing that Tan²(x/2) = (1 - cos(x)) / (1+cos(x)), we can simplify to:var y = wgs84EarthRadius / 2.0 * Math.Log((1.0 + Math.Sin(latitude)) / (1.0 - Math.Sin(latitude)));