calculate dx-squared