Compute the differential dy of \(y=x^2+3x-5\)
Christian’s Response:
The differential dy or derivative of y, can be calculated with the power rule of differentiation. Using this rule, we can identify the dy:
\[ y'(x)=(d/dx)(x^2+3x-5)\\ =(d/dx)x^2 + (d/dx)3x - (d/dx)5\\ =2x + 3(1) - 0\\ =2x + 3 \] Bonus: Now that I have solved for differential dy, I will solve for when x=2 in code.
# creates y(x)
y <- function(x) {
x^2 + 3*x - 5
}
# define dy(x)
dy <- function(x) {
2*x + 3
}
# create variable 2
x <-2
cat("y(", x, ") =", y(x), "\n")
## y( 2 ) = 5
cat("dy(", x, ") =", dy(x), "\n")
## dy( 2 ) = 7
The differential dy of y = x^2 + 3x -5 is dy = 2x +3. When x=2, dy=7