{"id":629,"date":"2025-10-09T15:26:46","date_gmt":"2025-10-09T15:26:46","guid":{"rendered":"https:\/\/content.one.lumenlearning.com\/calculus3\/?post_type=chapter&#038;p=629"},"modified":"2025-10-27T21:23:42","modified_gmt":"2025-10-27T21:23:42","slug":"directional-derivatives-learn-it-1","status":"publish","type":"chapter","link":"https:\/\/content.one.lumenlearning.com\/calculus3\/chapter\/directional-derivatives-learn-it-1\/","title":{"raw":"Directional Derivatives and the Gradient: Learn It 1","rendered":"Directional Derivatives and the Gradient: Learn It 1"},"content":{"raw":"<section class=\"textbox learningGoals\" aria-label=\"Learning Goals\">\r\n<ul>\r\n \t<li>Calculate directional derivatives in two dimensions<\/li>\r\n \t<li>Find and interpret the gradient vector<\/li>\r\n \t<li>Use the gradient to find the tangent to a level curve of a given function<\/li>\r\n \t<li>Calculate directional derivatives in three dimensions<\/li>\r\n<\/ul>\r\n<\/section>\r\n<p class=\"whitespace-normal break-words\">When you studied partial derivatives, you learned that a function [latex]z=f(x,y)[\/latex] has two partial derivatives: [latex]\\partial{z}\/\\partial{x}[\/latex] and [latex]\\partial{z}\/\\partial{y}[\/latex]. These derivatives correspond to each independent variable and represent instantaneous rates of change\u2014slopes of tangent lines. For example, [latex]\\partial{z}\/\\partial{x}[\/latex] gives the slope of a tangent line parallel to the [latex]x[\/latex]-axis, and [latex]\\partial{z}\/\\partial{y}[\/latex] gives the slope of a tangent line parallel to the [latex]y[\/latex]-axis.<\/p>\r\n<p class=\"whitespace-normal break-words\">But what if you want to find the slope of a tangent line that's not parallel to either axis? That's where directional derivatives come in.<\/p>\r\n\r\n<h2>Directional Derivatives<\/h2>\r\n<p class=\"whitespace-normal break-words\">Let's start with a surface defined by [latex]z=f(x, y)[\/latex]. Given a point [latex](a, b)[\/latex] in the domain of [latex]f[\/latex], we choose a direction to travel from that point. We measure this direction using an angle [latex]\\theta[\/latex], measured counterclockwise in the [latex]xy[\/latex]-plane, starting from the positive [latex]x[\/latex]-axis (Figure 1).<\/p>\r\n<p class=\"whitespace-normal break-words\">We travel a distance [latex]h[\/latex] in the direction given by the unit vector [latex]{\\bf{u}}=(\\cos\\theta){\\bf{i}}+(\\sin\\theta){\\bf{j}}[\/latex]. The [latex]z[\/latex]-coordinate of our destination point on the graph is [latex]z=f(a+h\\cos\\theta, b+h\\sin\\theta)[\/latex].<\/p>\r\n\r\n[caption id=\"attachment_1256\" align=\"aligncenter\" width=\"728\"]<img class=\"size-full wp-image-1256\" src=\"https:\/\/s3-us-west-2.amazonaws.com\/courses-images\/wp-content\/uploads\/sites\/5667\/2021\/09\/23010025\/4-6-1.jpeg\" alt=\"A shape in xyz space with point (a, b, f(a, b)). From the point, there is an arrow that represents the directional derivative. On the xy plane, the point (a, b) is marked and an angle of size \u03b8 is made between the projection of the directional derivative onto the plane and a line parallel to the x axis.\" width=\"728\" height=\"621\" \/> Figure 1. Finding the directional derivative at a point on the graph of [latex]z=f(x,y)[\/latex]. The slope of the black arrow on the graph indicates the value of the directional derivative at that point.[\/caption]\r\n<p class=\"whitespace-normal break-words\">To find the slope of the secant line, we divide the difference in [latex]z[\/latex]-values by the length of the line segment connecting the two points in the domain. Since the length is [latex]h[\/latex], the slope of the secant line is:<\/p>\r\n<p class=\"whitespace-normal break-words\" style=\"text-align: center;\">[latex]m_{\\text{sec}}=\\dfrac{f(a+h\\cos\\theta, b+h\\sin\\theta)-f(a, b)}{h}[\/latex]<\/p>\r\n<p class=\"whitespace-normal break-words\">To find the slope of the tangent line in this direction, we take the limit as [latex]h[\/latex] approaches zero.<\/p>\r\n\r\n<section class=\"textbox keyTakeaway\" aria-label=\"Key Takeaway\">\r\n<h3>directional derivative<\/h3>\r\nSuppose\u00a0[latex]z=f(x, y)[\/latex] is a function of two variables with a domain of\u00a0[latex]D[\/latex]. Let\u00a0[latex](a,b)\\in{D}[\/latex] and define\u00a0[latex]{\\bf{u}}=(\\cos\\theta){\\bf{i}}+(\\sin\\theta)\\bf{j}[\/latex]. Then the <strong>directional derivative<\/strong> of\u00a0[latex]f[\/latex] in the direction of\u00a0[latex]\\bf{u}[\/latex] is given by\r\n<p style=\"text-align: center;\">[latex]D_{\\bf{u}}f(a,b)=\\displaystyle\\lim_{h\\to0}\\dfrac{f(a+h\\cos\\theta,b+h\\sin\\theta)-f(a,b)}{h},[\/latex]<\/p>\r\nprovided the limit exists.\r\n\r\n<\/section>\r\n<p class=\"whitespace-normal break-words\">This definition provides a formal way to calculate directional derivatives in many cases.<\/p>\r\n\r\n<section class=\"textbox example\" aria-label=\"Example\">Let\u00a0[latex]\\theta=\\arccos(3\/5)[\/latex]. Find the directional derivative\u00a0[latex]D_{\\bf{u}}f(x,y)[\/latex] of\u00a0[latex]f(x,y)=x^2-xy+3y^2[\/latex] in the direction of\u00a0[latex]{\\bf{u}}=(\\cos\\theta){\\bf{i}}+(\\sin\\theta)\\bf{j}[\/latex]. What is\u00a0[latex]D_{\\bf{u}}f(-1,2)[\/latex]?[reveal-answer q=\"223676598\"]Show Solution[\/reveal-answer]\r\n[hidden-answer a=\"223676598\"]First of all, since [latex]\\cos\\theta=3\/5[\/latex] and\u00a0[latex]\\theta[\/latex] is acute, this implies\r\n<p style=\"text-align: center;\">[latex]\\large{\\sin\\theta=\\sqrt{1-\\left(\\frac35\\right)^2}=\\sqrt{\\frac{16}{25}}=\\frac45}[\/latex]<\/p>\r\nUsing\u00a0[latex]f(x,y)=x^2-xy+3y^2[\/latex], we first calculate\u00a0[latex]f(x+h\\cos\\theta,y+h\\sin\\theta)[\/latex]:\r\n\r\n[latex]\\begin{align}\r\n\r\nf(x+h\\cos\\theta,y+h\\sin\\theta)&amp;=(x+h\\cos\\theta)^2-(x+h\\cos\\theta)(y+h\\sin\\theta)+3(y+h\\sin\\theta)^2 \\\\\r\n\r\n&amp;=x^2+2xh\\cos\\theta+h^2\\cos^2\\theta-xy-xh\\sin\\theta-yh\\cos\\theta-h^2\\sin\\theta\\cos\\theta+3y^2 \\\\\r\n\r\n&amp;\\;\\;\\;+6yh\\sin\\theta+3h^2\\sin^2\\theta \\\\\r\n\r\n&amp;=x^2+2xh\\left(\\frac35\\right)+\\frac{9h^2}{25}-xy-\\frac{4xh}5-\\frac{3yh}5-\\frac{12h^2}{25}+3y^2 +6yh\\left(\\frac45\\right)+3h^2\\left(\\frac{16}{25}\\right) \\\\\r\n\r\n&amp;=x^2-xy+3y^2+\\frac{2xh}5+\\frac{9h^2}5+\\frac{21yh}5.\r\n\r\n\\end{align}[\/latex]\r\n\r\nWe substitute this expression into\u00a0the directional derivative of\u00a0[latex]f[\/latex] in the direction of\u00a0[latex]\\bf{u}[\/latex]:\r\n\r\n[latex]\\hspace{4cm}\\begin{align}\r\n\r\nD_{\\bf{u}}f(a,b)&amp;=\\displaystyle\\lim_{h\\to0}\\frac{f(a+h\\cos\\theta,b+h\\sin\\theta)-f(a,b)}{h} \\\\\r\n\r\n&amp;=\\displaystyle\\lim_{h\\to0}\\frac{(x^2-xy+3y^2+\\frac{2xh}5+\\frac{9h^2}5+\\frac{21yh}5)-(x^2-xy+3y^2)}{h} \\\\\r\n\r\n&amp;=\\displaystyle\\lim_{h\\to0}\\frac{\\frac{2xh}5+\\frac{9h^2}5+\\frac{21yh}5}{h} \\\\\r\n\r\n&amp;=\\displaystyle\\lim_{h\\to0}\\frac{2x}5+\\frac{9h}5+\\frac{21y}5 \\\\\r\n\r\n&amp;=\\frac{2x+21y}5.\r\n\r\n\\end{align}[\/latex]\r\n\r\nTo calculate\u00a0[latex]D_{\\bf{u}}f(-1,2)[\/latex], we substitute\u00a0[latex]x=-1[\/latex] and\u00a0[latex]y=2[\/latex] into this answer:\r\n\r\n[latex]\\hspace{4cm}\\begin{align}\r\n\r\nD_{\\bf{u}}f(-1,2)&amp;=\\frac{2(-1)+21(2)}5 \\\\\r\n\r\n&amp;=\\frac{-2+42}5 \\\\\r\n\r\n&amp;= 8.\r\n\r\n\\end{align}[\/latex]\r\n\r\n(See the following figure.)\r\n\r\n[caption id=\"attachment_1258\" align=\"aligncenter\" width=\"773\"]<img class=\"size-full wp-image-1258\" src=\"https:\/\/s3-us-west-2.amazonaws.com\/courses-images\/wp-content\/uploads\/sites\/5667\/2021\/09\/23010205\/4-6-2.jpeg\" alt=\"The shape f(x, y) = x2 \u2013 xy + 3y2 in xyz space with tangent plane at point (\u20131, 2, 15). There are two arrows from the point, one seemingly along the surface of the shape and the other in a direction on the plane. The one that corresponds to the plane is marked u = 3\/5 i + 4\/5 j.\" width=\"773\" height=\"541\" \/> Figure 2.\u00a0Finding the directional derivative in a given direction [latex]\\small{\\bf{u}}[\/latex]\u00a0at a given point on a surface. The plane is tangent to the surface at the given point [latex]\\small{(-1,2,15)}[\/latex][\/caption][\/hidden-answer]<\/section>\r\n<h3 class=\"text-lg font-bold text-text-100 mt-1 -mb-1.5\">Computing Directional Derivatives Using Partial Derivatives<\/h3>\r\n<p class=\"whitespace-normal break-words\">There's another approach to calculating directional derivatives that uses partial derivatives directly. This method is often more efficient than using the limit definition.<\/p>\r\n\r\n<section class=\"textbox keyTakeaway\" aria-label=\"Key Takeaway\">\r\n<h3>directional derivative of a function of two variables<\/h3>\r\nLet [latex]z=f(x, y)[\/latex] be a function of two variables [latex]x[\/latex] and [latex]y[\/latex], and assume that [latex]f_x[\/latex] and [latex]f_y[\/latex] exist. Then the directional derivative of [latex]f[\/latex] in the direction of [latex]{\\bf{u}}=\\cos\\theta{\\bf{i}}+\\sin\\theta\\bf{j}[\/latex] is given by:\r\n<p style=\"text-align: center;\">[latex]\\large{D_{\\bf{u}}f(x,y)=f_x(x,y)\\cos\\theta+f_y(x,y)\\sin\\theta}.[\/latex]<\/p>\r\n\r\n<\/section><section class=\"textbox connectIt\">\r\n<p style=\"text-align: center;\"><strong>Proof<\/strong><\/p>\r\n\r\n\r\n<hr \/>\r\n<p id=\"fs-id1167793938547\">The directional derivative of\u00a0[latex]f[\/latex] in the direction of\u00a0[latex]\\bf{u}[\/latex]\u00a0states that the directional derivative of [latex]f[\/latex] in the direction of [latex]{\\bf{u}}=\\cos\\theta{\\bf{i}}+\\sin\\theta\\bf{j}[\/latex] is given by<\/p>\r\n<p style=\"text-align: center;\">[latex]D_{\\bf{u}}f(a,b)=\\displaystyle\\lim_{h\\to0}\\frac{f(a+h\\cos\\theta,b+h\\sin\\theta)-f(a,b)}{h}[\/latex]<\/p>\r\nLet [latex]x=a+t\\cos\\theta[\/latex] and [latex]y=b+t\\sin\\theta[\/latex], and define [latex]g(t)=f(x, y)[\/latex]. Since [latex]f_x[\/latex] and [latex]f_y[\/latex] both exist, and therefore [latex]f[\/latex] is differentiable, we can use the chain rule for functions of two variables to calculate\u00a0[latex]{g}'(t)[\/latex]:\r\n\r\n[latex]\\hspace{8.5cm}\\begin{align}\r\n\r\ng'(t)&amp;=\\frac{\\partial f}{\\partial x}\\frac{dx}{dt}+\\frac{\\partial f}{\\partial y}\\frac{dy}{dt} \\\\\r\n\r\n&amp;=f_x(x,y)\\cos\\theta+f_y(x,y)\\sin\\theta.\r\n\r\n\\end{align}[\/latex]\r\n\r\nIf\u00a0[latex]t=0[\/latex], then\u00a0[latex]x=x_0(=a)[\/latex] and\u00a0[latex]y=y_0(=b)[\/latex], so\r\n<p style=\"text-align: center;\">[latex]g'(0)=f_x(x_0,y_0)\\cos\\theta+f_y(x_0,y_0)\\sin\\theta[\/latex]<\/p>\r\nBy the definition of\u00a0[latex]{g}'(t)[\/latex], it is also true that\r\n\r\n[latex]\r\n\r\n\\hspace{8.5cm}\\begin{align}\r\n\r\ng'(0)&amp;=\\displaystyle\\lim_{t\\to0}\\frac{g(t)-g(0)}t \\\\\r\n\r\n&amp;=\\displaystyle\\lim_{t\\to0}\\frac{f(x_0+t\\cos\\theta,y_0+t\\sin\\theta)-f(x_0,y_0)}t.\r\n\r\n\\end{align}[\/latex]\r\n\r\nTherefore,\u00a0[latex]D_{\\bf{u}}f(x_0,y_0)=f_x(x,y)\\cos\\theta+f_y(x,y)\\sin\\theta[\/latex].\r\n\r\n[latex]_\\blacksquare[\/latex]\r\n\r\n<\/section><section class=\"textbox example\" aria-label=\"Example\">Let\u00a0[latex]\\theta=\\arccos(3\/5)[\/latex]. Find the directional derivative\u00a0[latex]D_{\\bf{u}}f(x,y)[\/latex] of\u00a0[latex]f(x,y)=x^2-xy+3y^2[\/latex] in the direction of\u00a0[latex]{\\bf{u}}=(\\cos\\theta){\\bf{i}}+(\\sin\\theta)\\bf{j}[\/latex]. What is\u00a0[latex]D_{\\bf{u}}f(-1,2)[\/latex]?[reveal-answer q=\"547112905\"]Show Solution[\/reveal-answer]\r\n[hidden-answer a=\"547112905\"]First we must calculate the partial derivatives of\u00a0[latex]f[\/latex]:\r\n<p style=\"text-align: center;\">[latex]f_x=2x-y[\/latex]<\/p>\r\n<p style=\"text-align: center;\">[latex]f_y=-x+6y[\/latex],<\/p>\r\nThen we use\u00a0the Directional Derivative of a Function of Two Variables\u00a0with\u00a0[latex]\\theta=\\arccos(3\/5)[\/latex]:\r\n\r\n[latex]\\hspace{8.5cm}\\begin{align}\r\n\r\nD_{\\bf{u}}f(x,y)&amp;=f_x(x,y)\\cos\\theta+f_y(x,y)\\sin\\theta \\\\\r\n\r\n&amp;=(2x-y)\\frac35+(-x+6y)\\frac45 \\\\\r\n\r\n&amp;=\\frac{6x}5-\\frac{3y}5-\\frac{4x}5+\\frac{24y}5 \\\\\r\n\r\n&amp;=\\frac{2x+21y}5.\r\n\r\n\\end{align}[\/latex]\r\n\r\nTo calculate\u00a0[latex]D_{\\bf{u}}f(-1,2)[\/latex], let\u00a0[latex]x=-1[\/latex] and\u00a0[latex]y=2[\/latex]:\r\n<p style=\"text-align: center;\">[latex]D_{\\bf{u}}f(-1,2)=\\large{\\frac{2(-1)+21(2)}5}=\\large{\\frac{-2+42}5}=8.[\/latex]<\/p>\r\n[\/hidden-answer]\r\n\r\n<\/section><section class=\"textbox proTip\" aria-label=\"Pro Tip\">\r\n<p class=\"whitespace-normal break-words\"><strong>Working with Non-Unit Vectors<\/strong><\/p>\r\n<p class=\"whitespace-normal break-words\">If the direction vector you're given is not a unit vector, divide it by its magnitude first to get [latex]{\\bf{u}}[\/latex]. For example, if you want the directional derivative in the direction of [latex]\\langle-5,12\\rangle[\/latex], first find its magnitude: [latex]\\sqrt{(-5)^2+12^2}=\\sqrt{169}=13[\/latex]. Then [latex]{\\bf{u}}=\\langle-5\/13, 12\/13\\rangle[\/latex].<\/p>\r\n<p class=\"whitespace-normal break-words\">Then you can calculate:<\/p>\r\n<p class=\"whitespace-pre-wrap break-words\" style=\"text-align: center;\">[latex]\\begin{array}{ccc} D_{\\bf{u}}f(x,y)&amp;=&amp;\\nabla{f}(x,y)\\cdot{\\bf{u}} \\\\ &amp;=&amp;-\\frac5{13}(2x-y)+\\frac{12}{13}(-x+6y) \\\\ &amp;=&amp;-\\frac{22}{13}x+\\frac{17}{13}y \\end{array}[\/latex]<\/p>\r\n\r\n<\/section>","rendered":"<section class=\"textbox learningGoals\" aria-label=\"Learning Goals\">\n<ul>\n<li>Calculate directional derivatives in two dimensions<\/li>\n<li>Find and interpret the gradient vector<\/li>\n<li>Use the gradient to find the tangent to a level curve of a given function<\/li>\n<li>Calculate directional derivatives in three dimensions<\/li>\n<\/ul>\n<\/section>\n<p class=\"whitespace-normal break-words\">When you studied partial derivatives, you learned that a function [latex]z=f(x,y)[\/latex] has two partial derivatives: [latex]\\partial{z}\/\\partial{x}[\/latex] and [latex]\\partial{z}\/\\partial{y}[\/latex]. These derivatives correspond to each independent variable and represent instantaneous rates of change\u2014slopes of tangent lines. For example, [latex]\\partial{z}\/\\partial{x}[\/latex] gives the slope of a tangent line parallel to the [latex]x[\/latex]-axis, and [latex]\\partial{z}\/\\partial{y}[\/latex] gives the slope of a tangent line parallel to the [latex]y[\/latex]-axis.<\/p>\n<p class=\"whitespace-normal break-words\">But what if you want to find the slope of a tangent line that&#8217;s not parallel to either axis? That&#8217;s where directional derivatives come in.<\/p>\n<h2>Directional Derivatives<\/h2>\n<p class=\"whitespace-normal break-words\">Let&#8217;s start with a surface defined by [latex]z=f(x, y)[\/latex]. Given a point [latex](a, b)[\/latex] in the domain of [latex]f[\/latex], we choose a direction to travel from that point. We measure this direction using an angle [latex]\\theta[\/latex], measured counterclockwise in the [latex]xy[\/latex]-plane, starting from the positive [latex]x[\/latex]-axis (Figure 1).<\/p>\n<p class=\"whitespace-normal break-words\">We travel a distance [latex]h[\/latex] in the direction given by the unit vector [latex]{\\bf{u}}=(\\cos\\theta){\\bf{i}}+(\\sin\\theta){\\bf{j}}[\/latex]. The [latex]z[\/latex]-coordinate of our destination point on the graph is [latex]z=f(a+h\\cos\\theta, b+h\\sin\\theta)[\/latex].<\/p>\n<figure id=\"attachment_1256\" aria-describedby=\"caption-attachment-1256\" style=\"width: 728px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1256\" src=\"https:\/\/s3-us-west-2.amazonaws.com\/courses-images\/wp-content\/uploads\/sites\/5667\/2021\/09\/23010025\/4-6-1.jpeg\" alt=\"A shape in xyz space with point (a, b, f(a, b)). From the point, there is an arrow that represents the directional derivative. On the xy plane, the point (a, b) is marked and an angle of size \u03b8 is made between the projection of the directional derivative onto the plane and a line parallel to the x axis.\" width=\"728\" height=\"621\" \/><figcaption id=\"caption-attachment-1256\" class=\"wp-caption-text\">Figure 1. Finding the directional derivative at a point on the graph of [latex]z=f(x,y)[\/latex]. The slope of the black arrow on the graph indicates the value of the directional derivative at that point.<\/figcaption><\/figure>\n<p class=\"whitespace-normal break-words\">To find the slope of the secant line, we divide the difference in [latex]z[\/latex]-values by the length of the line segment connecting the two points in the domain. Since the length is [latex]h[\/latex], the slope of the secant line is:<\/p>\n<p class=\"whitespace-normal break-words\" style=\"text-align: center;\">[latex]m_{\\text{sec}}=\\dfrac{f(a+h\\cos\\theta, b+h\\sin\\theta)-f(a, b)}{h}[\/latex]<\/p>\n<p class=\"whitespace-normal break-words\">To find the slope of the tangent line in this direction, we take the limit as [latex]h[\/latex] approaches zero.<\/p>\n<section class=\"textbox keyTakeaway\" aria-label=\"Key Takeaway\">\n<h3>directional derivative<\/h3>\n<p>Suppose\u00a0[latex]z=f(x, y)[\/latex] is a function of two variables with a domain of\u00a0[latex]D[\/latex]. Let\u00a0[latex](a,b)\\in{D}[\/latex] and define\u00a0[latex]{\\bf{u}}=(\\cos\\theta){\\bf{i}}+(\\sin\\theta)\\bf{j}[\/latex]. Then the <strong>directional derivative<\/strong> of\u00a0[latex]f[\/latex] in the direction of\u00a0[latex]\\bf{u}[\/latex] is given by<\/p>\n<p style=\"text-align: center;\">[latex]D_{\\bf{u}}f(a,b)=\\displaystyle\\lim_{h\\to0}\\dfrac{f(a+h\\cos\\theta,b+h\\sin\\theta)-f(a,b)}{h},[\/latex]<\/p>\n<p>provided the limit exists.<\/p>\n<\/section>\n<p class=\"whitespace-normal break-words\">This definition provides a formal way to calculate directional derivatives in many cases.<\/p>\n<section class=\"textbox example\" aria-label=\"Example\">Let\u00a0[latex]\\theta=\\arccos(3\/5)[\/latex]. Find the directional derivative\u00a0[latex]D_{\\bf{u}}f(x,y)[\/latex] of\u00a0[latex]f(x,y)=x^2-xy+3y^2[\/latex] in the direction of\u00a0[latex]{\\bf{u}}=(\\cos\\theta){\\bf{i}}+(\\sin\\theta)\\bf{j}[\/latex]. What is\u00a0[latex]D_{\\bf{u}}f(-1,2)[\/latex]?<\/p>\n<div class=\"qa-wrapper\" style=\"display: block\"><button class=\"show-answer show-answer-button collapsed\" data-target=\"q223676598\">Show Solution<\/button><\/p>\n<div id=\"q223676598\" class=\"hidden-answer\" style=\"display: none\">First of all, since [latex]\\cos\\theta=3\/5[\/latex] and\u00a0[latex]\\theta[\/latex] is acute, this implies<\/p>\n<p style=\"text-align: center;\">[latex]\\large{\\sin\\theta=\\sqrt{1-\\left(\\frac35\\right)^2}=\\sqrt{\\frac{16}{25}}=\\frac45}[\/latex]<\/p>\n<p>Using\u00a0[latex]f(x,y)=x^2-xy+3y^2[\/latex], we first calculate\u00a0[latex]f(x+h\\cos\\theta,y+h\\sin\\theta)[\/latex]:<\/p>\n<p>[latex]\\begin{align}    f(x+h\\cos\\theta,y+h\\sin\\theta)&=(x+h\\cos\\theta)^2-(x+h\\cos\\theta)(y+h\\sin\\theta)+3(y+h\\sin\\theta)^2 \\\\    &=x^2+2xh\\cos\\theta+h^2\\cos^2\\theta-xy-xh\\sin\\theta-yh\\cos\\theta-h^2\\sin\\theta\\cos\\theta+3y^2 \\\\    &\\;\\;\\;+6yh\\sin\\theta+3h^2\\sin^2\\theta \\\\    &=x^2+2xh\\left(\\frac35\\right)+\\frac{9h^2}{25}-xy-\\frac{4xh}5-\\frac{3yh}5-\\frac{12h^2}{25}+3y^2 +6yh\\left(\\frac45\\right)+3h^2\\left(\\frac{16}{25}\\right) \\\\    &=x^2-xy+3y^2+\\frac{2xh}5+\\frac{9h^2}5+\\frac{21yh}5.    \\end{align}[\/latex]<\/p>\n<p>We substitute this expression into\u00a0the directional derivative of\u00a0[latex]f[\/latex] in the direction of\u00a0[latex]\\bf{u}[\/latex]:<\/p>\n<p>[latex]\\hspace{4cm}\\begin{align}    D_{\\bf{u}}f(a,b)&=\\displaystyle\\lim_{h\\to0}\\frac{f(a+h\\cos\\theta,b+h\\sin\\theta)-f(a,b)}{h} \\\\    &=\\displaystyle\\lim_{h\\to0}\\frac{(x^2-xy+3y^2+\\frac{2xh}5+\\frac{9h^2}5+\\frac{21yh}5)-(x^2-xy+3y^2)}{h} \\\\    &=\\displaystyle\\lim_{h\\to0}\\frac{\\frac{2xh}5+\\frac{9h^2}5+\\frac{21yh}5}{h} \\\\    &=\\displaystyle\\lim_{h\\to0}\\frac{2x}5+\\frac{9h}5+\\frac{21y}5 \\\\    &=\\frac{2x+21y}5.    \\end{align}[\/latex]<\/p>\n<p>To calculate\u00a0[latex]D_{\\bf{u}}f(-1,2)[\/latex], we substitute\u00a0[latex]x=-1[\/latex] and\u00a0[latex]y=2[\/latex] into this answer:<\/p>\n<p>[latex]\\hspace{4cm}\\begin{align}    D_{\\bf{u}}f(-1,2)&=\\frac{2(-1)+21(2)}5 \\\\    &=\\frac{-2+42}5 \\\\    &= 8.    \\end{align}[\/latex]<\/p>\n<p>(See the following figure.)<\/p>\n<figure id=\"attachment_1258\" aria-describedby=\"caption-attachment-1258\" style=\"width: 773px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1258\" src=\"https:\/\/s3-us-west-2.amazonaws.com\/courses-images\/wp-content\/uploads\/sites\/5667\/2021\/09\/23010205\/4-6-2.jpeg\" alt=\"The shape f(x, y) = x2 \u2013 xy + 3y2 in xyz space with tangent plane at point (\u20131, 2, 15). There are two arrows from the point, one seemingly along the surface of the shape and the other in a direction on the plane. The one that corresponds to the plane is marked u = 3\/5 i + 4\/5 j.\" width=\"773\" height=\"541\" \/><figcaption id=\"caption-attachment-1258\" class=\"wp-caption-text\">Figure 2.\u00a0Finding the directional derivative in a given direction [latex]\\small{\\bf{u}}[\/latex]\u00a0at a given point on a surface. The plane is tangent to the surface at the given point [latex]\\small{(-1,2,15)}[\/latex]<\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/section>\n<h3 class=\"text-lg font-bold text-text-100 mt-1 -mb-1.5\">Computing Directional Derivatives Using Partial Derivatives<\/h3>\n<p class=\"whitespace-normal break-words\">There&#8217;s another approach to calculating directional derivatives that uses partial derivatives directly. This method is often more efficient than using the limit definition.<\/p>\n<section class=\"textbox keyTakeaway\" aria-label=\"Key Takeaway\">\n<h3>directional derivative of a function of two variables<\/h3>\n<p>Let [latex]z=f(x, y)[\/latex] be a function of two variables [latex]x[\/latex] and [latex]y[\/latex], and assume that [latex]f_x[\/latex] and [latex]f_y[\/latex] exist. Then the directional derivative of [latex]f[\/latex] in the direction of [latex]{\\bf{u}}=\\cos\\theta{\\bf{i}}+\\sin\\theta\\bf{j}[\/latex] is given by:<\/p>\n<p style=\"text-align: center;\">[latex]\\large{D_{\\bf{u}}f(x,y)=f_x(x,y)\\cos\\theta+f_y(x,y)\\sin\\theta}.[\/latex]<\/p>\n<\/section>\n<section class=\"textbox connectIt\">\n<p style=\"text-align: center;\"><strong>Proof<\/strong><\/p>\n<hr \/>\n<p id=\"fs-id1167793938547\">The directional derivative of\u00a0[latex]f[\/latex] in the direction of\u00a0[latex]\\bf{u}[\/latex]\u00a0states that the directional derivative of [latex]f[\/latex] in the direction of [latex]{\\bf{u}}=\\cos\\theta{\\bf{i}}+\\sin\\theta\\bf{j}[\/latex] is given by<\/p>\n<p style=\"text-align: center;\">[latex]D_{\\bf{u}}f(a,b)=\\displaystyle\\lim_{h\\to0}\\frac{f(a+h\\cos\\theta,b+h\\sin\\theta)-f(a,b)}{h}[\/latex]<\/p>\n<p>Let [latex]x=a+t\\cos\\theta[\/latex] and [latex]y=b+t\\sin\\theta[\/latex], and define [latex]g(t)=f(x, y)[\/latex]. Since [latex]f_x[\/latex] and [latex]f_y[\/latex] both exist, and therefore [latex]f[\/latex] is differentiable, we can use the chain rule for functions of two variables to calculate\u00a0[latex]{g}'(t)[\/latex]:<\/p>\n<p>[latex]\\hspace{8.5cm}\\begin{align}    g'(t)&=\\frac{\\partial f}{\\partial x}\\frac{dx}{dt}+\\frac{\\partial f}{\\partial y}\\frac{dy}{dt} \\\\    &=f_x(x,y)\\cos\\theta+f_y(x,y)\\sin\\theta.    \\end{align}[\/latex]<\/p>\n<p>If\u00a0[latex]t=0[\/latex], then\u00a0[latex]x=x_0(=a)[\/latex] and\u00a0[latex]y=y_0(=b)[\/latex], so<\/p>\n<p style=\"text-align: center;\">[latex]g'(0)=f_x(x_0,y_0)\\cos\\theta+f_y(x_0,y_0)\\sin\\theta[\/latex]<\/p>\n<p>By the definition of\u00a0[latex]{g}'(t)[\/latex], it is also true that<\/p>\n<p>[latex]\\hspace{8.5cm}\\begin{align}    g'(0)&=\\displaystyle\\lim_{t\\to0}\\frac{g(t)-g(0)}t \\\\    &=\\displaystyle\\lim_{t\\to0}\\frac{f(x_0+t\\cos\\theta,y_0+t\\sin\\theta)-f(x_0,y_0)}t.    \\end{align}[\/latex]<\/p>\n<p>Therefore,\u00a0[latex]D_{\\bf{u}}f(x_0,y_0)=f_x(x,y)\\cos\\theta+f_y(x,y)\\sin\\theta[\/latex].<\/p>\n<p>[latex]_\\blacksquare[\/latex]<\/p>\n<\/section>\n<section class=\"textbox example\" aria-label=\"Example\">Let\u00a0[latex]\\theta=\\arccos(3\/5)[\/latex]. Find the directional derivative\u00a0[latex]D_{\\bf{u}}f(x,y)[\/latex] of\u00a0[latex]f(x,y)=x^2-xy+3y^2[\/latex] in the direction of\u00a0[latex]{\\bf{u}}=(\\cos\\theta){\\bf{i}}+(\\sin\\theta)\\bf{j}[\/latex]. What is\u00a0[latex]D_{\\bf{u}}f(-1,2)[\/latex]?<\/p>\n<div class=\"qa-wrapper\" style=\"display: block\"><button class=\"show-answer show-answer-button collapsed\" data-target=\"q547112905\">Show Solution<\/button><\/p>\n<div id=\"q547112905\" class=\"hidden-answer\" style=\"display: none\">First we must calculate the partial derivatives of\u00a0[latex]f[\/latex]:<\/p>\n<p style=\"text-align: center;\">[latex]f_x=2x-y[\/latex]<\/p>\n<p style=\"text-align: center;\">[latex]f_y=-x+6y[\/latex],<\/p>\n<p>Then we use\u00a0the Directional Derivative of a Function of Two Variables\u00a0with\u00a0[latex]\\theta=\\arccos(3\/5)[\/latex]:<\/p>\n<p>[latex]\\hspace{8.5cm}\\begin{align}    D_{\\bf{u}}f(x,y)&=f_x(x,y)\\cos\\theta+f_y(x,y)\\sin\\theta \\\\    &=(2x-y)\\frac35+(-x+6y)\\frac45 \\\\    &=\\frac{6x}5-\\frac{3y}5-\\frac{4x}5+\\frac{24y}5 \\\\    &=\\frac{2x+21y}5.    \\end{align}[\/latex]<\/p>\n<p>To calculate\u00a0[latex]D_{\\bf{u}}f(-1,2)[\/latex], let\u00a0[latex]x=-1[\/latex] and\u00a0[latex]y=2[\/latex]:<\/p>\n<p style=\"text-align: center;\">[latex]D_{\\bf{u}}f(-1,2)=\\large{\\frac{2(-1)+21(2)}5}=\\large{\\frac{-2+42}5}=8.[\/latex]<\/p>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"textbox proTip\" aria-label=\"Pro Tip\">\n<p class=\"whitespace-normal break-words\"><strong>Working with Non-Unit Vectors<\/strong><\/p>\n<p class=\"whitespace-normal break-words\">If the direction vector you&#8217;re given is not a unit vector, divide it by its magnitude first to get [latex]{\\bf{u}}[\/latex]. For example, if you want the directional derivative in the direction of [latex]\\langle-5,12\\rangle[\/latex], first find its magnitude: [latex]\\sqrt{(-5)^2+12^2}=\\sqrt{169}=13[\/latex]. Then [latex]{\\bf{u}}=\\langle-5\/13, 12\/13\\rangle[\/latex].<\/p>\n<p class=\"whitespace-normal break-words\">Then you can calculate:<\/p>\n<p class=\"whitespace-pre-wrap break-words\" style=\"text-align: center;\">[latex]\\begin{array}{ccc} D_{\\bf{u}}f(x,y)&=&\\nabla{f}(x,y)\\cdot{\\bf{u}} \\\\ &=&-\\frac5{13}(2x-y)+\\frac{12}{13}(-x+6y) \\\\ &=&-\\frac{22}{13}x+\\frac{17}{13}y \\end{array}[\/latex]<\/p>\n<\/section>\n","protected":false},"author":15,"menu_order":16,"template":"","meta":{"_candela_citation":"[]","pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-629","chapter","type-chapter","status-publish","hentry"],"part":428,"module-header":"learn_it","content_attributions":[],"internal_book_links":[],"video_content":null,"cc_video_embed_content":{"cc_scripts":"","media_targets":[]},"try_it_collection":null,"_links":{"self":[{"href":"https:\/\/content.one.lumenlearning.com\/calculus3\/wp-json\/pressbooks\/v2\/chapters\/629","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/content.one.lumenlearning.com\/calculus3\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/content.one.lumenlearning.com\/calculus3\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/calculus3\/wp-json\/wp\/v2\/users\/15"}],"version-history":[{"count":9,"href":"https:\/\/content.one.lumenlearning.com\/calculus3\/wp-json\/pressbooks\/v2\/chapters\/629\/revisions"}],"predecessor-version":[{"id":1810,"href":"https:\/\/content.one.lumenlearning.com\/calculus3\/wp-json\/pressbooks\/v2\/chapters\/629\/revisions\/1810"}],"part":[{"href":"https:\/\/content.one.lumenlearning.com\/calculus3\/wp-json\/pressbooks\/v2\/parts\/428"}],"metadata":[{"href":"https:\/\/content.one.lumenlearning.com\/calculus3\/wp-json\/pressbooks\/v2\/chapters\/629\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/content.one.lumenlearning.com\/calculus3\/wp-json\/wp\/v2\/media?parent=629"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/calculus3\/wp-json\/pressbooks\/v2\/chapter-type?post=629"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/calculus3\/wp-json\/wp\/v2\/contributor?post=629"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/content.one.lumenlearning.com\/calculus3\/wp-json\/wp\/v2\/license?post=629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}