0

I have this problem, where the function is to derived with respect to $\theta$

$$f(\theta) = \frac{1}{2} (y-N(x, \theta))^2 $$

I know that I am supposed to use the chain rule here, but I am still a little confused. How can $h(x)' = g(x)*g(x)'$ be of any use here. Any tips are appreciated.

  • Are $x$ and $y$ independent of $\theta$, so that they may be considered constants? – MPW Mar 16 '21 at 15:00
  • No, I don't think you can consider x and y as independent of $\theta$ in this case. I am sorry if there is not enough context here. I have left out a large part of the problem , because I only wanted some tips on how to partial derivate this function, not a solution to the problem that I am actually working on. – magn_hild Mar 16 '21 at 15:23
  • So we must consider $x=x(\theta), y=y(\theta)$? – MPW Mar 16 '21 at 15:29

1 Answers1

0

The chain rule is used if there is a concatenation of functions that you want to find the derivative of. In this case, you have the function

$\theta \mapsto y-N(x,\theta)$

first, and that you concatenate with the function

$z \mapsto \frac{1}{2} z^2$.

Now if $f: X\rightarrow Y$ and $g: Y\rightarrow Z$ are functions, then the chain rule says

$(g\circ f)'(x) = (g'\circ f)(x) \cdot f'(x)$,

which in this case means

$f'(\theta) = (y-N(x,\theta)) \cdot \left(-\frac{\partial N(x,\theta)}{\partial \theta}\right)$.

Edit: OP said that $x$ and $y$ also should be considered as functions of $\theta$. In this case, we get

$f'(\theta) = (y(\theta) - N(x(\theta),\theta)) \cdot (y'(\theta) - N'(x(\theta),\theta)) = (y(\theta) - N(x(\theta),\theta)) \cdot (y'(\theta) - \left(\frac{\partial N(x(\theta),\theta)}{\partial x} \cdot \frac{dx}{d\theta} + \frac{\partial N(x(\theta),\theta)}{\partial \theta}\right)$.

Here I used the notation with the prime to denote total derivatives.

S.Farr
  • 1,190
  • 1
    You're missing a minus sign, and technically that should be a partial derivative. So you should have $$f'(\theta) = -(y-N(x,\theta))\cdot\frac{\partial N(x,\theta)}{\partial\theta}$$

    Also, your chain rule should be $(g\circ f)'(x) =(\color{red}{g'\circ f})(x)\cdot f'(x)$

    – MPW Mar 16 '21 at 15:02
  • You're right, I should have read over my answer one more time before posting. I fixed all the issues now. – S.Farr Mar 16 '21 at 15:12
  • According to OP, $x$ and $y$ should be regarded as functions of $\theta$, so you now have to use the chain rule for several variables. – MPW Mar 16 '21 at 15:28
  • this makes sense! thank you so much for the help, both of you S.Farr and MPW! – magn_hild Mar 16 '21 at 16:02