Given a curve [ y = x(A – x) ], the task is to find tangent at given point (x, y) on that curve, where A, x, y are integers.
Input: A = 2, x = 2, y = 0 Output: y = -2x - 4 Since y = x(2 - x) y = 2x - x^2 differentiate it with respect to x dy/dx = 2 - 2x put x = 2, y = 0 in this equation dy/dx = 2 - 2* 2 = -2 equation => (Y - 0 ) = ((-2))*( Y - 2) => y = -2x -4 Input: A = 3, x = 4, y = 5 Output: Not possible Point is not on that curve
- First find if the given point is on that curve or not.
- If the point is on that curve then, Find the derivative
- Calculate the gradient of the tangent by Putting x, y in dy/dx.
- Determine the equation of the tangent by substituting the gradient of the tangent and the coordinates of the given point into the gradient-point form of the straight line equation, where Equation of normal is Y – y = ( dy/dx ) * (X – x).
- Find normal at a given point on the curve
- Find nth term of the Dragon Curve Sequence
- Find the other end point of a line with given one end and mid
- Find the Missing Point of Parallelogram
- Program to find the Break Even Point
- Program to find the mid-point of a line
- Find a point such that sum of the Manhattan distances is minimized
- Program to find GCD of floating point numbers
- Find a point that lies inside exactly K given squares
- Find the foot of perpendicular of a point in a 3 D plane
- Find if a point lies inside a Circle
- Find mirror image of a point in 2-D plane
- Find intersection point of lines inside a section
- Find an Integer point on a line segment with given two ends
- Find foot of perpendicular from a point in 2 D plane to a Line
Below is the implementation of the above approach:
// differentiate is positive
echo “y = “,
$dif , “x+” , -$x * $dif + $y;
// differentiate is zero
echo “Not possible”;
// Driver code
// declare variable
$A = 2;
$x = 2;
$y = 0;
// call function findTangent
findTangent($A, $x, $y);
// This code is contributed by Sachin
y = -2x-4
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.