# Straight line equation that accounts for known error in X&Y?

Tags:
1. Apr 15, 2015

### AlanKirby

I'm looking for how to mathematically relate X and Y, in such a way that the Chi-Squared per degree of freedom is minimised. However I can't understand how this would work, given that I'm trying to use known X,Y dX and dY (errors) values, to get the related gradient and intercept for the line of best fit.

nb: I'm currently trying to program a straight line in java that accounts for known errors in both X and Y, however everything I find either obtains errors, or is way over complicated.

Please help!!

2. Apr 15, 2015

### Staff: Mentor

Fit programs can certainly do that, and I guess somewhere hidden in this or at least one of those articles is the right formula.

Alternatively, write down the equation for $\chi^2$ yourself, calculate the derivatives and see how the expression can get minimized. I'm not sure if that gives a single nice formula.

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook