Why is $nabla f(p) = sum_{i=1}^n 2(p - p_i) = 0$?












0












$begingroup$


Given $n$ points in space, $p_1,p_2, cdots , p_n$, find the point $p$ for which $f(p) = sum_{i=1}^n |p-p_j|^2$.



I have the following in my notes:



(1) $f(p) = sum_{i=1}^n |p-p_i|^2 = sum_{i=1}^n (p-p_i)cdot(p-p_i)$



=$sum_{i=1}^n p cdot p - 2p cdot p_i + p_{i} cdot p_{i}$



.........................................



(2) Find $p$ to minimize $f(p)$.



$nabla f(p) = sum_{i=1}^n 2(p - p_i) = 0$



$np = sum_{i=1}^n p_i rightarrow frac{1}{n} sum_{i=1}^n p_i = bar{p}$



$bar{p}$ is a critical point for $f(p)$



.........................................



(3) $D^2 f = 2I_n$



.........................................



(4) $f(p)-f(bar{p}) = sum_{i=1}^n |p-bar{p_i}|^2 - |bar{p} - p_i|^2$



= $sum_{i=1}^n |p|^2 -2p cdot p_i + |p_i|^2 - |bar{p}|^2 +2bar{p} cdot p_i - |p_i|^2$



= $sum_{i=1}^n |p|^2 - |bar{p}|^2 + 2(bar{p}-p) cdot p_i$



=$2bar{p} cdot p_i = bar{p} cdot (sum p_i) cdot 2 = bar{p} cdot nbar{p} cdot 2 = 2n|bar{p}|^2$



= $n(|p|^2 + |bar{p}|^2 -2npcdot bar{p} = n(|p-bar{p}|^2) ge 0$



I find that part (1) is self-explanatory.



For part (2), why do we do $nabla f(p) = sum_{i=1}^n 2(p cdot p_i) = 0$?










share|cite|improve this question











$endgroup$








  • 1




    $begingroup$
    the dot should be a minus sign; maybe you transcribed something incorrectly or wherever you got the notes has a typo
    $endgroup$
    – T_M
    Dec 5 '18 at 0:49
















0












$begingroup$


Given $n$ points in space, $p_1,p_2, cdots , p_n$, find the point $p$ for which $f(p) = sum_{i=1}^n |p-p_j|^2$.



I have the following in my notes:



(1) $f(p) = sum_{i=1}^n |p-p_i|^2 = sum_{i=1}^n (p-p_i)cdot(p-p_i)$



=$sum_{i=1}^n p cdot p - 2p cdot p_i + p_{i} cdot p_{i}$



.........................................



(2) Find $p$ to minimize $f(p)$.



$nabla f(p) = sum_{i=1}^n 2(p - p_i) = 0$



$np = sum_{i=1}^n p_i rightarrow frac{1}{n} sum_{i=1}^n p_i = bar{p}$



$bar{p}$ is a critical point for $f(p)$



.........................................



(3) $D^2 f = 2I_n$



.........................................



(4) $f(p)-f(bar{p}) = sum_{i=1}^n |p-bar{p_i}|^2 - |bar{p} - p_i|^2$



= $sum_{i=1}^n |p|^2 -2p cdot p_i + |p_i|^2 - |bar{p}|^2 +2bar{p} cdot p_i - |p_i|^2$



= $sum_{i=1}^n |p|^2 - |bar{p}|^2 + 2(bar{p}-p) cdot p_i$



=$2bar{p} cdot p_i = bar{p} cdot (sum p_i) cdot 2 = bar{p} cdot nbar{p} cdot 2 = 2n|bar{p}|^2$



= $n(|p|^2 + |bar{p}|^2 -2npcdot bar{p} = n(|p-bar{p}|^2) ge 0$



I find that part (1) is self-explanatory.



For part (2), why do we do $nabla f(p) = sum_{i=1}^n 2(p cdot p_i) = 0$?










share|cite|improve this question











$endgroup$








  • 1




    $begingroup$
    the dot should be a minus sign; maybe you transcribed something incorrectly or wherever you got the notes has a typo
    $endgroup$
    – T_M
    Dec 5 '18 at 0:49














0












0








0





$begingroup$


Given $n$ points in space, $p_1,p_2, cdots , p_n$, find the point $p$ for which $f(p) = sum_{i=1}^n |p-p_j|^2$.



I have the following in my notes:



(1) $f(p) = sum_{i=1}^n |p-p_i|^2 = sum_{i=1}^n (p-p_i)cdot(p-p_i)$



=$sum_{i=1}^n p cdot p - 2p cdot p_i + p_{i} cdot p_{i}$



.........................................



(2) Find $p$ to minimize $f(p)$.



$nabla f(p) = sum_{i=1}^n 2(p - p_i) = 0$



$np = sum_{i=1}^n p_i rightarrow frac{1}{n} sum_{i=1}^n p_i = bar{p}$



$bar{p}$ is a critical point for $f(p)$



.........................................



(3) $D^2 f = 2I_n$



.........................................



(4) $f(p)-f(bar{p}) = sum_{i=1}^n |p-bar{p_i}|^2 - |bar{p} - p_i|^2$



= $sum_{i=1}^n |p|^2 -2p cdot p_i + |p_i|^2 - |bar{p}|^2 +2bar{p} cdot p_i - |p_i|^2$



= $sum_{i=1}^n |p|^2 - |bar{p}|^2 + 2(bar{p}-p) cdot p_i$



=$2bar{p} cdot p_i = bar{p} cdot (sum p_i) cdot 2 = bar{p} cdot nbar{p} cdot 2 = 2n|bar{p}|^2$



= $n(|p|^2 + |bar{p}|^2 -2npcdot bar{p} = n(|p-bar{p}|^2) ge 0$



I find that part (1) is self-explanatory.



For part (2), why do we do $nabla f(p) = sum_{i=1}^n 2(p cdot p_i) = 0$?










share|cite|improve this question











$endgroup$




Given $n$ points in space, $p_1,p_2, cdots , p_n$, find the point $p$ for which $f(p) = sum_{i=1}^n |p-p_j|^2$.



I have the following in my notes:



(1) $f(p) = sum_{i=1}^n |p-p_i|^2 = sum_{i=1}^n (p-p_i)cdot(p-p_i)$



=$sum_{i=1}^n p cdot p - 2p cdot p_i + p_{i} cdot p_{i}$



.........................................



(2) Find $p$ to minimize $f(p)$.



$nabla f(p) = sum_{i=1}^n 2(p - p_i) = 0$



$np = sum_{i=1}^n p_i rightarrow frac{1}{n} sum_{i=1}^n p_i = bar{p}$



$bar{p}$ is a critical point for $f(p)$



.........................................



(3) $D^2 f = 2I_n$



.........................................



(4) $f(p)-f(bar{p}) = sum_{i=1}^n |p-bar{p_i}|^2 - |bar{p} - p_i|^2$



= $sum_{i=1}^n |p|^2 -2p cdot p_i + |p_i|^2 - |bar{p}|^2 +2bar{p} cdot p_i - |p_i|^2$



= $sum_{i=1}^n |p|^2 - |bar{p}|^2 + 2(bar{p}-p) cdot p_i$



=$2bar{p} cdot p_i = bar{p} cdot (sum p_i) cdot 2 = bar{p} cdot nbar{p} cdot 2 = 2n|bar{p}|^2$



= $n(|p|^2 + |bar{p}|^2 -2npcdot bar{p} = n(|p-bar{p}|^2) ge 0$



I find that part (1) is self-explanatory.



For part (2), why do we do $nabla f(p) = sum_{i=1}^n 2(p cdot p_i) = 0$?







calculus multivariable-calculus






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Dec 5 '18 at 2:00







K.M

















asked Dec 5 '18 at 0:43









K.MK.M

686412




686412








  • 1




    $begingroup$
    the dot should be a minus sign; maybe you transcribed something incorrectly or wherever you got the notes has a typo
    $endgroup$
    – T_M
    Dec 5 '18 at 0:49














  • 1




    $begingroup$
    the dot should be a minus sign; maybe you transcribed something incorrectly or wherever you got the notes has a typo
    $endgroup$
    – T_M
    Dec 5 '18 at 0:49








1




1




$begingroup$
the dot should be a minus sign; maybe you transcribed something incorrectly or wherever you got the notes has a typo
$endgroup$
– T_M
Dec 5 '18 at 0:49




$begingroup$
the dot should be a minus sign; maybe you transcribed something incorrectly or wherever you got the notes has a typo
$endgroup$
– T_M
Dec 5 '18 at 0:49










1 Answer
1






active

oldest

votes


















1












$begingroup$

Take



$$
f({bf p}) = sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_iright)
$$



The gradient is just



begin{eqnarray}
nabla f({bf p}) &=& frac{partial}{partial {bf p}}sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_i right) \
&=& sum_i left( 2{bf p} - 2{bf p}_i right) = 2sum_i {bf p} - 2sum_i{bf p}_i \
&=& 2n {bf p} - 2sum_i {bf p}_i = 2n left({bf p}-frac{1}{n}sum_i{bf p}_iright) \
&=& 2n ({bf p} - overline{{bf p}})
end{eqnarray}






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Why is $frac{partial}{partial {bf p}}sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_i right) = sum_i left( 2{bf p} - 2{bf p}_i right)$?
    $endgroup$
    – K.M
    Dec 5 '18 at 1:01












  • $begingroup$
    @K.M Apply the product rule of the derivative
    $endgroup$
    – caverac
    Dec 5 '18 at 1:11











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3026416%2fwhy-is-nabla-fp-sum-i-1n-2p-p-i-0%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1












$begingroup$

Take



$$
f({bf p}) = sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_iright)
$$



The gradient is just



begin{eqnarray}
nabla f({bf p}) &=& frac{partial}{partial {bf p}}sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_i right) \
&=& sum_i left( 2{bf p} - 2{bf p}_i right) = 2sum_i {bf p} - 2sum_i{bf p}_i \
&=& 2n {bf p} - 2sum_i {bf p}_i = 2n left({bf p}-frac{1}{n}sum_i{bf p}_iright) \
&=& 2n ({bf p} - overline{{bf p}})
end{eqnarray}






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Why is $frac{partial}{partial {bf p}}sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_i right) = sum_i left( 2{bf p} - 2{bf p}_i right)$?
    $endgroup$
    – K.M
    Dec 5 '18 at 1:01












  • $begingroup$
    @K.M Apply the product rule of the derivative
    $endgroup$
    – caverac
    Dec 5 '18 at 1:11
















1












$begingroup$

Take



$$
f({bf p}) = sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_iright)
$$



The gradient is just



begin{eqnarray}
nabla f({bf p}) &=& frac{partial}{partial {bf p}}sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_i right) \
&=& sum_i left( 2{bf p} - 2{bf p}_i right) = 2sum_i {bf p} - 2sum_i{bf p}_i \
&=& 2n {bf p} - 2sum_i {bf p}_i = 2n left({bf p}-frac{1}{n}sum_i{bf p}_iright) \
&=& 2n ({bf p} - overline{{bf p}})
end{eqnarray}






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Why is $frac{partial}{partial {bf p}}sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_i right) = sum_i left( 2{bf p} - 2{bf p}_i right)$?
    $endgroup$
    – K.M
    Dec 5 '18 at 1:01












  • $begingroup$
    @K.M Apply the product rule of the derivative
    $endgroup$
    – caverac
    Dec 5 '18 at 1:11














1












1








1





$begingroup$

Take



$$
f({bf p}) = sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_iright)
$$



The gradient is just



begin{eqnarray}
nabla f({bf p}) &=& frac{partial}{partial {bf p}}sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_i right) \
&=& sum_i left( 2{bf p} - 2{bf p}_i right) = 2sum_i {bf p} - 2sum_i{bf p}_i \
&=& 2n {bf p} - 2sum_i {bf p}_i = 2n left({bf p}-frac{1}{n}sum_i{bf p}_iright) \
&=& 2n ({bf p} - overline{{bf p}})
end{eqnarray}






share|cite|improve this answer









$endgroup$



Take



$$
f({bf p}) = sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_iright)
$$



The gradient is just



begin{eqnarray}
nabla f({bf p}) &=& frac{partial}{partial {bf p}}sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_i right) \
&=& sum_i left( 2{bf p} - 2{bf p}_i right) = 2sum_i {bf p} - 2sum_i{bf p}_i \
&=& 2n {bf p} - 2sum_i {bf p}_i = 2n left({bf p}-frac{1}{n}sum_i{bf p}_iright) \
&=& 2n ({bf p} - overline{{bf p}})
end{eqnarray}







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Dec 5 '18 at 0:56









caveraccaverac

14.5k31130




14.5k31130












  • $begingroup$
    Why is $frac{partial}{partial {bf p}}sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_i right) = sum_i left( 2{bf p} - 2{bf p}_i right)$?
    $endgroup$
    – K.M
    Dec 5 '18 at 1:01












  • $begingroup$
    @K.M Apply the product rule of the derivative
    $endgroup$
    – caverac
    Dec 5 '18 at 1:11


















  • $begingroup$
    Why is $frac{partial}{partial {bf p}}sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_i right) = sum_i left( 2{bf p} - 2{bf p}_i right)$?
    $endgroup$
    – K.M
    Dec 5 '18 at 1:01












  • $begingroup$
    @K.M Apply the product rule of the derivative
    $endgroup$
    – caverac
    Dec 5 '18 at 1:11
















$begingroup$
Why is $frac{partial}{partial {bf p}}sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_i right) = sum_i left( 2{bf p} - 2{bf p}_i right)$?
$endgroup$
– K.M
Dec 5 '18 at 1:01






$begingroup$
Why is $frac{partial}{partial {bf p}}sum_i left({bf p}cdot {bf p} - 2{bf p}cdot {bf p}_i + {bf p}_icdot {bf p}_i right) = sum_i left( 2{bf p} - 2{bf p}_i right)$?
$endgroup$
– K.M
Dec 5 '18 at 1:01














$begingroup$
@K.M Apply the product rule of the derivative
$endgroup$
– caverac
Dec 5 '18 at 1:11




$begingroup$
@K.M Apply the product rule of the derivative
$endgroup$
– caverac
Dec 5 '18 at 1:11


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3026416%2fwhy-is-nabla-fp-sum-i-1n-2p-p-i-0%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Ellipse (mathématiques)

Quarter-circle Tiles

Mont Emei