Gradient of a Line is the measure of the inclination of the line with respect to the X-axis which is also called slope of a line. It is used to calculate the steepness of a line. Gradient is calculated by the ratio of the rate of change in y-axis to the change in x-axis.
In this article, we will discuss the gradient of a line, methods for its calculation, the gradient of a curve, applications of gradient of a line, some solved examples, and practice problems related to the gradient of a line.
What is Gradient?
Gradient refers to the rate of change of a quantity with respect to some independent variable.
In mathematics, gradient implies the degree of inclination of any entity towards something. Gradient also means the rate of descent or ascent of any hill or highway. Gradient, in mathematics, provides insight of the direction and steepness of the line.
What is Gradient of a Line?
Gradient of a line is the measure of its degree of inclination with respect to the X-axis. For gradient of a line, the term "slope" is used. In mathematics, the gradient of a line is typically denoted by the letter 'm'.
Gradient of a line is calculated as the ratio change in y coordinate to the change in x coordinate of a line. It is also calculated as the trigonometric tangent of angle made by the line with positive X-direction in anticlockwise direction.
Gradient of a Line Formula
The formula for Gradient of a Line passing through two points (x1, y1) and (x2, y2) is given by,
m = (y2 −y1 )/(x2 −x1 )
OR
m = Δy/Δx
It represents the change in ordinates with respect to change in abscissa for a line. Various methods to calculate gradient or slope of a line are discussed as follows.

How to Calculate Gradient of a Line?
There are various methods to calculate gradient of a line, i.e. its degree of inclination with respect to X-axis. This degree of inclination is also defined in terms of trigonometric tangent of the angle made by the line with positive X-direction taken in anticlockwise direction.
Gradient of a line is particularly called the slope of a line. Different methods to calculate the gradient of a line based on type of inputs available are discussed as follows:
- Angle of Inclination
- Coordinates of two points on the line
- Equation of line
Angle of Inclination
Let the angle made by the line with positive X direction taken in anticlockwise direction be θ and m denote the gradient or slope of the line. Then we have,
m = tan θ
Hence, the gradient of a line can be measured by evaluating the value of tangent of the angle made by the line with positive X-direction taken in anticlockwise direction.
Coordinates of Two Points
Let (x1, y1) and (x2, y2) denote the coordinates of two points on the line and m be the slope of the line. Then we have,
m = (y2-y1)/(x2-x1)
Hence, the other method to calculate the gradient of a line is given the ratio of change in y-coordinate to the change in x-coordinate.
Equation of Line
If equation of the line is given as ax + by + c = 0, we represent it in the form y = mx + c, where 'm' is the slope or gradient of the line. It is mathematically expressed as follows,
We have ax + by + c = 0
⇒ y = (-a/b) x + (-c/b)
⇒ m = -a/b
Thus, for a line represented as ax + by + c=0, slope or gradient is given as m = -a/b, i.e. -(coefficient of x)/(coefficient of y).
Gradient of a Curve
Gradient of a curve is the gradient or slope of the tangent drawn to the curve at a given point. It determines the rate of change of the functional value represented by the curve at the given point.
Gradient of a Curve is not a constant value necessarily, i.e. gradient of a curve depends on the point where it needs to be calculated.
It is generally calculated as derivative of the function represented by the curve. For instance, a curve is represented as y = f(x), then gradient or slope of the tangent at any point is given as follows,
m = dy/dx = f '(x)
Note: A positive value of gradient indicates that the curve or function is increasing whereas negative value indicates that curve or function is decreasing. If the slope value is zero, it indicates that the function is constant.
Gradient of Different Lines
There can be various different lines that can be named such as:
Let’s discuss the gradient of these lines one by one:
Gradient of Horizontal lines
Gradient of a horizontal line is zero as it is parallel to the X-axis, thereby making an angle of 0° with X-axis. As trigonometric tangent of 0 is zero, thus gradient of a horizontal line is zero.
It can also be defined by change in y-coordinate (which is 0 here) to the change in x-coordinate, which is represented as:
Gradient of Horizontal Line = 0/change in x-coordinate = 0
Gradient of Vertical lines
Gradient of a vertical line is infinite or not defined as it makes an angle of 90° with X-axis and trigonometric tangent of 90° being infinite or not defined, the slope of a vertical line is also not defined.
It can also be defined by change in y-coordinate to the change in x-coordinate (which is 0 here), which is represented as:
Gradient of Horizontal Line = Change in y-coordinate/0 = Not Defined
Gradient of a Line Perpendicular to Another Line
The slope of Perpendicular Lines are inversely proportional to each other and their product is -1. Let the gradient of a line = m1 and gradient of the line perpendicular to it = m2. Then, we have the mathematical relation m1 × m2 = -1. Thus, gradient of a line perpendicular to another line would be,
m1 = -1/m2
Gradient of Parallel Lines
The slope of Parallel Lines is the same as both the lines are at the same inclination with the positive x-axis. In other words, if the slope of one line is m then the slope of a line parallel to that line is also m.
Types of Gradient of a Line
Gradient of a line in general tells about the inclination of a line with respect to the X-axis. The types of gradient of a line include:
- Positive Gradient
- Negative Gradient
- Zero Gradient
- Undefined Gradient
Gradient can be used to tell about the extent of inclination of the line with respect to positive X-axis direction. It is discussed as follows:
Positive Gradient
Positive Gradient of a line implies that the line makes an acute angle with positive direction of X-axis, i.e. the angle between the line and positive X-axis taken in anticlockwise direction ranges from 0 degree to 90°.
For curves, if gradient of the tangent line drawn at a point is positive, then the curve is said to have an increasing nature.
Negative Gradient
Negative Gradient of a line implies that the line makes an obtuse angle with positive direction of X-axis, i.e. the angle between the line and positive X-axis taken in anticlockwise direction ranges from 90° to 180°.
For curves, if gradient of the tangent line drawn at a point is negative, then the curve is said to have an decreasing nature.
Zero Gradient
Zero gradient is defined for the horizontal lines only. If the line is horizontal (parallel to x-axis), the gradient is zero as tan 0°= 0. Hence, in this case, m = 0.
Undefined Gradient
The gradient of all vertical lines is always undefined. If the line is vertical (perpendicular to x-axis), the gradient is undefined as tan 90° = undefined.
Applications of Gradient of a Line
Gradient of a Line gives information about a line which can be used to determine its relation with other lines and understanding its geometry. It is useful in various engineering applications and holds importance in subjects such as coordinate geometry, vector algebra and three dimensional geometry. Some important applications of Gradient of a Line are listed as follows:
- It can be used to find equation of the line if a point on the line is known.
- It gives information about inclination of the line with respect to X-axis.
- Angle between two lines can be calculated with help of their gradient's value.
- Gradient of a line can be used to check if the two lines are parallel or perpendicular to each other.
- Gradient of a curve helps to know about the increasing or decreasing nature of the curve.
Read More,
Solved Questions on Gradient of a Line
Question 1: Find the gradient of a line which passes through the points (3,5) and (1,4).
Solution:
We know that gradient of a line passing through (x1, y1) and (x2, y2) is given as,
m = (y2-y1)/(x2-x1)
Therefore, gradient or slope of the given line would be,
m = (5-4)/(3-1) = 1/2
Thus, we have calculated the gradient of given line as 1/2.
Question 2: A line makes an angle of 60° with positive X-direction in anticlockwise direction. Find the gradient of line.
Solution:
Here, we have θ = 60° and we know that,
Gradient of a line, m = tan 60° = √3
Thus, gradient of the given line is found to be √3.
Question 3: What is gradient of the line represented as 3x+4y+5=0?
Solution:
We know that,
Slope or Gradient of a line = -(coefficient of x)/(coefficient of y)
Therefore, for given line, we have,
Gradient, m = -3/4
Question 4: Determine the gradient and nature of the curve represented as y = x2 + 5x + 12 at x=2.
Solution:
For any curve, gradient is the slope of tangent line drawn at the given point and it given as dy/dx. Here we have,
y = x2 + 5x + 12
⇒ dy/dx = 2x + 5
At x = 2, dy/dx = 2 × 2 + 5 = 4 + 5 = 9
Thus, a positive value of gradient is obtained which indicates that the function is increasing at x = 2.
Practice Problems on Gradient of a Line
Problem 1: Find the gradient of a line passing through the points (1, 2) and (3, 4).
Problem 2: Find the angle made by a line with positive direction of X-axis whose gradient is 1/√3.
Problem 3: What is gradient of the line represented by the equation 4x+3y+12=0.
Problem 4: Find the expression for Gradient of the curve represented as y = ln x at any point.
Problem 5: Find the gradient of the curve y = sin x at x = π/2.
Similar Reads
Point Gradient Formula
A straight line in a cartesian plane passes through an infinite number of points. Each of these points has its own x and y- coordinates. The points a line passes through are used to find its slope. Not only that but such points can also be used to write the equation of a line. One such method is dis
4 min read
Line of Best Fit
Line of Best Fit: A Line of best fit is a fundamental concept of statistics used to analyze the relationship between two variables. It helps predict the values of one variable based on the values of another variable(given). Line of best fit is a straight line drawn through a scatter plot of data poi
11 min read
How to use Linear Gradient in CSS?
The linear gradient in CSS is a type of gradient where colors transition in a straight line, either vertically, horizontally, or at any specified angle. The gradient in CSS can be often used to add smooth color transitions to the backgrounds, buttons, or other UI elements. Linear gradients can enhan
5 min read
Gradient
The gradient is a fundamental concept in calculus that extends the idea of a derivative to multiple dimensions. It plays a crucial role in vector calculus, optimization, machine learning, and physics. The gradient of a function provides the direction of the steepest ascent, making it essential in ar
4 min read
Derivative of a Function
Derivative of a Function is the rate of change in the given function with respect to an independent variable. The derivative of a given function in Calculus is found using the First Principle of differentiation. The process of finding the derivative of a function is also called the Differentiation o
12 min read
Family of Lines
Family simply means a collection of individuals that share common properties among them. Similarly, a family of lines is a collection of lines that share some common properties among them. These lines are related to each other via some specific characteristics, such as being parallel, perpendicular,
7 min read
tf.GradientTape in TensorFlow
TensorFlow is an open-source library for data science and machine learning. It provides various tools and APIs for building, training, and deploying models. One of the core features of TensorFlow is automatic differentiation (autodiff). Autodiff is the process of computing the gradients of a functio
9 min read
Gradient borders in CSS
Creating visually appealing borders can significantly enhance the user experience on your website. One such technique is the use of gradient borders. Although CSS does not directly support gradient borders, there are two effective methods to achieve this:Property ValuesValueDescriptionlinear-gradien
4 min read
Gradient Descent Algorithm in R
Gradient Descent is a fundamental optimization algorithm used in machine learning and statistics. It is designed to minimize a function by iteratively moving toward the direction of the steepest descent, as defined by the negative of the gradient. The goal is to find the set of parameters that resul
6 min read
Higher-Order gradients in TensorFlow
Higher order gradients are one of the important topics in the domains of machine learning. TensorFlow has a function named tf.GradientTape that will help us to be familiar with higher order gradients. In this article, we will be understanding first and higher order derivatives. Then, we will discuss
7 min read