Reputation: 1052
Given the quadratic cost function f(a) = 1/2 (a-y)^2
, I know that the derivative of the function with respect to a
is a - y
.
But I have no clue how to get there...
Can you provide me a link where this is explained easily?
Upvotes: 1
Views: 1763
Reputation: 66805
Derivative in respect to what? Probably "a". Thus this is just about taking a derivative of a square of a difference.
f(a) = 1/2 (a-y)^2
df / da = d[ 1/2 (a-y)^2 ] / da
= 1/2 d[ (a^2 -2ay + y^2) ] / da
= 1/2 ( d[ a^2 ] / da - 2 d[ ay ] / da + d[ y^2 ] / da)
= 1/2 ( 2a - 2y + 0 )
= a - y
Upvotes: 5