This simple question “is a straight line linear?” came to my mind and couldn’t get out of it. It seems to be obvious, so it should have an obvious answer. However, when I dig into the research and try to find proof for this simple answer, I realized it’s more complex than I thought and more interesting!

Linearity and non-linearity are terms commonly used in Data Science and Math. We try to figure out if a problem can be solved using linear or non-linear models, or if our data is linearly separable. If we widely use these terms, it’s important to understand them well, isn’t it? So what does it mean that something is linear by the book?

It’s simple… draw it!

Let’s think and try to visualize linearity. What comes to your mind? For me, it’s a simple straight line. Such a line is described by the following formula:

Linear function formula f(x) = ax + b.

Linear (?) function formula (image by Author).

And indeed it is called a linear function [1]. In this formula, we have a variable x, and two parameters a and b. Let’s assume that a = 1,_ b = -2_, and plot it:

Plot of linear function f(x) = x-2. It’s a straight line going through points (-2, 0) and (0, 2).

Linear function f(x) = x -2 (image by Author).

In the picture we can see that line goes through point A (0, 2) as f(0) = 2 and point B (-2, 0), because f(-2) = 0. That’s how we usually imagine linearity.

We also tend to think about linearity in terms of proportionality [2]. It means that the input is proportional to the output. Such intuitive thinking is natural for us, however, we need to remember that formally proportionality is a separate, wider term.

By definition proportionality of two variables or quantities is a relation that occurs when ratio or product of these quantities is a constant. Having variables x and y, they are proportional if:

Proportionality coefficient formula. x divided by y, equals k.

Proportionality coefficient (image by Author).

Where k is a constant. In this situation, if x is increasing, y also is increasing. The same applies when we decrease our variables, it’s proportional.

Variables are inversely proportional if their product is a constant:

Inverse proportionality coefficient formula. x dot y equals k.

Inverse proportionality coefficient (image by Author).

To check if it fits our intuition, we can transform this formula like this:

Transformed inverse proportionality formula. x equals k dvidied by y.

Transformed inverse proportionality formula (image by Author).

Assuming that k is greater than 0, and y is not equal to 0, while increasing yx is decreasing. So everything is ok, it’s inversely proportional.

#mathematics #math #science #data-science #learning #data science

Is a straight line linear?
1.10 GEEK