1
$\begingroup$

I'm working on a simple linear regression model in a physics course, where we are doing measurements of the round trip speed of light, over increasing distances. We are using the Least Squares method to determine the slope of a linear function $y(x) = B*x$. In this case, it is given that $B$ kan be written as

$$B = \frac{\sum_{i=1}^{N} x_i y_i} {\sum_{i=1}^N x_i^2} \qquad(1)$$

Where I get stuck, is in trying to find the formula for error of $B$, when given the error of $y$, and assuming the error in $x$ is negligibly small.

Using this general formula for propagation of error (for a function $B(x, y)$: $$\delta B = \sqrt{\left(\frac{\partial B}{\partial x} \delta x\right)^2 + \left(\frac{\partial B}{\partial y} \delta y\right)^2} \qquad(2) $$

which, when $\delta x\approx0 $, simplifies to $$ \delta B = \left|\frac{\partial B}{\partial y}\right|\delta y \space. \qquad(3) $$

At this point, I'm not sure how I should go about partially differentiating the sums in the equation for $B$, in order to find $\delta B$. I know that the final answer should come out to $$ \delta B = \frac{\delta y}{\sqrt{\sum_{i=1}^{N} x_i^2}}\space, \qquad(4) $$ but would love some guidance as to how to get from formulas (1) and (3) to the final (4)! How does the process of partial differentiation work when you're partially differentiating a formula with sums in it?

EDIT (for clarification): We are working with a set of measurements $(x_i, y_i)$, where $y$ is a given distance of travel for a light pulse (metres), and $x$ is the time which the pulse takes to traverse that distance (seconds). Such that $y$ is a linear function of $x$, and $B$ should work out to be equal to the speed of light in m/s. The measurements of $x$ and $y$ are made in pairs, so for example: $$ (x_1, y_1) = (3.3*10^{-9}, 1)$$ $$ (x_2, y_2) = (6.4*10^{-9}, 2)$$

$\delta y$ is the standard deviation / error of the measurements taken of $y$.

Thanks in advance!

$\endgroup$
2
  • 1
    $\begingroup$ The act of partial differentiation is linear, so when differentiating a sum, you just sum the derivative of the summand; more pressingly, please define more clearly what the $y_i$ and $y$ is; that is so you can know how $y_i$ depends on $y$, in order fo you to differentiate one wrt to another $\endgroup$ Commented Jan 22 at 21:01
  • $\begingroup$ Thank you, @LourencoEntrudo! To clarify, we are working with a set of measurements ($x_i$, $y_i$), where $y$ is a given distance of travel for a light pulse (metres), and $x$ is the time which the pulse takes to traverse that distance (seconds). Such that $y$ is a linear function of $x$, and $B$ should work out to be equal to the speed of light in m/s. The measurements of $x$ and $y$ are made in pairs, so for example ($x_1$, $y_1$) = ($3.3*10^{-9}$, $1$) and ($x_2$, $y_2$) = ($6.4*10^{-9}$, $2$). $\delta y$ is the standard deviation / error of the measurements taken of $y$. $\endgroup$
    – THH
    Commented Jan 23 at 10:10

1 Answer 1

1
$\begingroup$

Here is how to obtain (4): $$ \left| \frac{\partial B}{\partial y} \right| = \left| \frac{\partial}{\partial y} \left(\frac{\sum_{i=1}^{n} x_iy_i}{\sum_{i=1}^{n} x_i^2} \right) \right|= \left| \begin{pmatrix} \frac{\partial}{\partial y_1} \left(\frac{\sum_{i=1}^{n} x_iy_i}{\sum_{i=1}^{n} x_i^2} \right) \\ \vdots \\ \frac{\partial}{\partial y_n} \left(\frac{\sum_{i=1}^{n} x_iy_i}{\sum_{i=1}^{n} x_i^2} \right) \end{pmatrix} \right|= \left| \begin{pmatrix} \frac{x_1}{\sum_{i=1}^{n} x_i^2} \\ \vdots \\ \frac{x_n}{\sum_{i=1}^{n} x_i^2} \end{pmatrix} \right| = \sqrt{\sum_{i=1}^n \left( \frac{x_{i}}{\sum_{i=1}^{n} x_i^2}\right)^2} = \frac{1}{\sqrt{\sum_{i=1}^n x_i^2}}. $$ I hope this is helpful.

$\endgroup$
2
  • $\begingroup$ Thank you, @Filipe, this helped a lot! As a follow up question, I am wondering about the move from step 4 to 5. I'm interpreting the fourth expression as being equal to $\lvert\sum_{i=1}^n\frac{x_i}{\sum_{i=1}^n x_i^2}\rvert$. When raising to the second power and taking the square root of that, should step 5 not be equal to $\sqrt{(\sum_{i=1}^n\frac{x_i}{\sum_{i=1}^n x_i^2})^2}$ ? In which case, it looks to me that it does not equal the final equation. Is there a way to show that they indeed are equal, or have I misunderstoop a step along the way? $\endgroup$
    – THH
    Commented Jan 23 at 11:06
  • $\begingroup$ $\left| \begin{pmatrix} \frac{x_1}{\sum_{i=1}^{n} x_i^2} \\ \vdots \\ \frac{x_n}{\sum_{i=1}^{n} x_i^2} \end{pmatrix} \right| = \sqrt{\sum_{i=1}^n \left( \frac{x_{i}}{\sum_{i=1}^{n} x_i^2}\right)^2} $ because the norm of the vector $(z_1, \cdots, z_n)$ is given by $\sqrt{\sum_{i=1}^nz_i^2}$. Computing this one gets $\sqrt{\sum_{i=1}^n \left( \frac{x_{i}}{\sum_{i=1}^{n} x_i^2}\right)^2} = \sqrt{\sum_{i=1}^n \frac{x_{i}^2}{(\sum_{i=1}^{n} x_i^2)^2}}= \sqrt{\frac{\sum_{i=1}^n x_i^2}{(\sum_{i=1}^n x_i^2)^2}} = \sqrt{\frac{1}{\sum_{i=1}^n x_i^2}}.$ If you have any more questions, feel free to ask! $\endgroup$ Commented Jan 23 at 11:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .