2
$\begingroup$

I need help differentiating a fraction containing two summations.

Given the weighted mean

$ \bar{x} = \frac{\sum\limits_{i=1}^{\rm N} x_{i}/\sigma_{i}^{2}}{\sum\limits_{i=1}^{\rm N} 1/\sigma_{i}^{2}}$

where $x_{i}$ and $\sigma_{i}$ are uncorrelated. The error propagation formula

$\sigma_{f}^2 = \sigma_{f}^2 \left(\frac{\delta f }{\delta x}\right)^2 + \sigma_{f}^2 \left(\frac{\delta f }{\delta y}\right)^2 + ...$

yields the error on $\bar{x}$ as: $\sigma_{\bar{x}}^2 = \sum\limits_{i=1}^{\rm N} \left(\frac{\delta \bar{x} }{\delta x_{i}}\right)^2 \sigma_{i}^2$

The literature* solves the derivative as:

$\frac{\delta \bar{x} }{\delta x_{i}} = \frac{\delta }{\delta x_{i}} \frac{\sum\limits_{i=1}^{\rm N} x_{i}/\sigma_{i}^2}{\sum\limits_{i=1}^{\rm N} 1/\sigma_{i}^2} = \frac{1/\sigma_{i}^2}{\sum\limits_{i=1}^{\rm N} 1/\sigma_{i}^2}$

I cannot figure out how this result is achieved. By my working, if $\sigma_{i}$ can be treated as a constant, then $\frac{\delta \bar{x} }{\delta x_{i}}=1$.

Am I missing something? I have tried the Quotient rule but I don't see how it applies in this case.

Eqn. 4.19, Bevington, Data Reduction and Error Analysis for the Physical Sciences http://astro.cornell.edu/academics/courses/astro3310/Books/Bevington_opt.pdf

2 Answers 2

1

It is not necessary to apply the quotient rule, since the function is linear in each $x_i, 1\leq i\leq N$. Let's denote the constant \begin{align*} \sum_{i=1}^N\frac{1}{\sigma_i^2}=C \end{align*}

The function can then be written for $1\leq i\leq N$ \begin{align*} \overline{x}&=\frac{1}{C}\sum_{j=1}^N\frac{x_j}{\sigma_j^2}\\ &=\frac{1}{C\sigma_i^2}x_i+\frac{1}{C}\sum_{{j=1}\atop{j\ne i}}^N\frac{x_j}{\sigma_j^2} \end{align*} which is of the form \begin{align*} \overline{x}(x_i)=a x_i + b\qquad\qquad a,b \quad\text{const.} \end{align*}

The derivative $\frac{\partial}{\partial x_i}\overline{x}$ is therefore

\begin{align*} \frac{\partial}{\partial x_i}\overline{x}&=\frac{\partial }{\partial x_i}\left( \frac{1}{C\sigma_i^2}x_i+\frac{1}{C}\sum_{{j=1}\atop{j\ne i}}^N\frac{x_j}{\sigma_j^2}\right)\\ &=\frac{1}{C\sigma_i^2}\qquad\qquad\qquad\qquad\qquad\qquad 1\leq i\leq N \end{align*}

Note: We have to use a different index variable $j$ for summation to avoid conflicts with the variable $x_i$.


Add-on: [2017-01-22] Some remarks to the index notation with respect to OPs comments.

It seems that Eqn 4.18 in the referred book causes some troubles due to the index notation. \begin{align*} \frac{\partial}{\partial x_i}\frac{\sum\left(x_i/\sigma_i^2\right)}{\sum\left(1/\sigma_i^2\right)} =\frac{1/\sigma_i^2}{\sum\left(1/\sigma_i^2\right)}\tag{1} \end{align*}

At first we take a look at the left hand side of (1). The expression can be equivalently written as \begin{align*} \frac{\partial}{\partial x_i}\frac{\sum\left(x_i/\sigma_i^2\right)}{\sum\left(1/\sigma_i^2\right)} =\frac{\partial}{\partial x_i}\frac{\sum\left(x_j/\sigma_j^2\right)}{\sum\left(1/\sigma_k^2\right)} =\frac{\partial}{\partial x_i}\frac{\sum_{j=1}^{N}\left(x_j/\sigma_j^2\right)}{\sum_{k=1}^{N}\left(1/\sigma_k^2\right)}\tag{2} \end{align*}

When looking at $x_i$ in \begin{align*} \sum\left(x_i/\sigma_i^2\right)\tag{3} \end{align*} the index $i$ is a so-called bound variable. This means

  • the scope of $i$ in (3) belongs to the $\Sigma$ symbol and is limited by the parenthesis

$$\sum\color{blue}{\left(\right.}x_i/\sigma_i^2\color{blue}{\left.\right)}$$

  • any usage of $i$ somewhere else means another, different symbol

  • the symbol $i$ in the derivative operator $\frac{\partial}{\partial x_i}$ has nothing to do with the symbol $i$ in (3)

  • the symbol $i$ in the sum $\sum\left(1/\sigma_i^2\right)$ has nothing to do with $i$ in (3).

Hint: Since the indices $i$ in the two sums and in the derivative operator have nothing in common, it is usually more convenient to use distinct variable names, e.g. $i,j,k$ as we can see in (2).

The expression $\frac{\partial}{\partial x_i}$ stands for the derivative of any $x_i$ arbitrarily, fixed chosen from $1\leq i \leq N$.

Albeit the notation the authors use is mathematically correct, it should be avoided as overloading of the same symbol makes the text harder to read for the less experienced.

  • 0
    Thanks very much. Would you mind clarifying the steps taken to get: $\dfrac{1}{C} \sum\limits_{j=1}^{N}\frac{x_{j}}{\sigma_{j}^2} = \frac{1}{C\sigma_{i}^2}x_{i} + \dfrac{1}{C} \sum\limits_{j=1}^{N}\frac{x_{j}}{\sigma_{j}^2}$2017-01-22
  • 0
    @smashbro: You're welcome! The sum is split into two parts. The first part consists of the term with index $i$ only, the second part is the sum of all other terms with index $j, j\ne i$. Note that at the bottom of the summation sign $i$ is explicitly excluded.2017-01-22
  • 0
    Why is there only one term with the index $i$ rather than $n$ terms?2017-01-22
  • 0
    @smashbro: The partial derivative is done with respect to $x_i$. The summation index $j$ is bounded to the summation symbol $\Sigma$ and independent from the index $i$. In fact it is necessary to denote the summation index with another symbol than $i$. We have to avoid using the same symbol for different usage.2017-01-22
  • 0
    @smashbro: I've added some information which might be helpful.2017-01-22
2

Note that: $\frac{\delta }{\delta x_{i}} \frac{\sum\limits_{i=1}^{\rm N} x_{i}/\sigma_{i}^2}{\sum\limits_{i=1}^{\rm N} 1/\sigma_{i}^2} = \frac{1}{\sum\limits_{i=1}^{\rm N} 1/\sigma_{i}^2}\frac{\delta }{\delta x_{i}} \sum\limits_{i=1}^{\rm N} x_{i}/\sigma_{i}^2 ~~~\mathbf{\neq}~~~ \frac{1}{\sum\limits_{i=1}^{\rm N} 1/\sigma_{i}^2}\sum\limits_{i=1}^{\rm N}\frac{\delta }{\delta x_{i}}(x_i/\sigma_i^2) $

It's very, very easy to mistake the inequality for an equality because the same letter $i$ in the leftmost and central terms is used to denote three different index variables, inside and outside of the two summations: there's a very high risk of confusing two different things both called $i$ when the $\frac{\delta }{\delta x_{i}}$ operator is "brought inside" the summation in the rightmost term. Using for the three different indices three different names $h,i,j$ (a highly recommended "safety practice") yields a slightly uglier but far less misleading:

$\frac{1}{\sum\limits_{i=1}^{\rm N} 1/\sigma_{i}^2}\frac{\delta }{\delta x_{i}} \sum\limits_{i=1}^{\rm N} x_{i}/\sigma_{i}^2 = \frac{1}{\sum\limits_{h=1}^{\rm N} 1/\sigma_{h}^2}\frac{\delta }{\delta x_{i}} \sum\limits_{j=1}^{\rm N} x_{j}/\sigma_{j}^2 = \frac{1}{\sum\limits_{h=1}^{\rm N} 1/\sigma_{h}^2} \sum\limits_{j=1}^{\rm N} \frac{\delta }{\delta x_{i}} (x_{j}/\sigma_{j}^2) = \frac{1}{\sum\limits_{h=1}^{\rm N} 1/\sigma_{h}^2} (1/\sigma_i^2)$

since $\frac{\delta }{\delta x_{i}} (x_{j}/\sigma_{j}^2)=0$ if $i\neq j$.