Simple Linear Regression
Let’s Start with the Simplest Case
Imagine a situation where only one factor is responsible for an outcome.
For example:
- Marks depend only on study hours
- Salary depends only on years of experience
- House price depends only on area
In such cases, predicting the output becomes much easier.
This is where Simple Linear Regression comes into the picture.
What Does “Simple” Mean Here?
It simply means:
There is only one independent variable and one dependent variable.
Because of this:
- The relationship can be shown using a 2D graph
- The model can be represented by a straight line
Simple Linear Regression tries to answer one basic question:
“If X changes by 1 unit, how much will Y change?”
To answer this, the model:
- Plots data points
- Draws a straight line
- Adjusts the line until it fits the data best
Now that we know what problem Simple Linear Regression solves, let us formally define it and understand how it works.
Example Dataset
Consider the following example:
| Weight (kg) | Height (cm) |
| 74 | 170 |
| 80 | 180 |
| 75 | 175.5 |
| …. | …. |
| …. | … |
| … | … |
| … | …. |
| … | …. |
| … | … |
- Weight (X) → Independent variable
- Height (Y) → Dependent variable
Here, height depends on weight, so height is the output.
Independent Variable and Dependent Variable
Independent Variable (X):
The independent variable is the input variable whose value is given or controlled. It does not depend on any other variable in the model and is used to make predictions.
Dependent Variable (Y):
The dependent variable is the output variable whose value depends on the independent variable. It changes according to the input provided.
Example Explanation
Weight (X) → Independent variable
Height (Y) → Dependent variable
Here, height depends on weight, meaning changes in weight influence height. Therefore:
Weight is treated as the independent (input) variable
Height is treated as the dependent (output) variable
In Simple Words
The variable that causes the change is called the independent variable,
and the variable that responds to that change is called the dependent variable.
4. Plotting the Data
- Weight is plotted on the X-axis
- Height is plotted on the Y-axis
- Each pair (X, Y) is shown as a point on the graph
After plotting, we observe that the points roughly follow a straight-line pattern.

3. Best Fit Line
- After plotting the data points, a straight line is drawn through the data.
- This line is called the Best Fit Line or Regression Line.
- The line tries to pass as close as possible to all data points.


