Difference between variables, parameters and constants

A constant is something like a "number". It doesn't change as variables change. For example $3$ is a constant as is $\pi$.

A parameter is a constant that defines a class of equations. $$\left(\frac xa\right)^2 + \left(\frac yb\right)^2 = 1$$ is the general equation for an ellipse. $a$ and $b$ are constants in this equation, but if we want to talk about the entire class of ellipses then they are also parameters -- because even though they are constant for any particular ellipse, they can take any positive real values.

A variable is an element of the domain or codomain of a relation. Remember that functions are just relations so the input and output of functions are variables. For example, if we talk about the function $x \mapsto ax +3$, then $x$ is a variable and $a$ is a parameter -- and thus a constant. $3$ is also a constant but it is not a parameter.

A "known" variable is typically a value that the conditions of the problem dictate the variable must take. For example if we are discussing an object an free fall, then acceleration is a variable. But physics puts a constraint on the value that that variable may take -- acceleration in free fall is $a=g\approx 9.8$. Thus, though $a$ may be defined as the input of a function, it must take a "known" value. Thus it is a known variable.

The Pythagorean theorem states that $a^2 + b^2 = c^2$ for sides $a,b$ and hypotenuse $c$ of a right triangle. These are parameters -- thus they are also constants.


They are all the same sort of thing on different levels of abstraction/generalization. Setting a value creates a more specialized (less general) version of the mathematical object (function, optimization problem, etc.), and replacing a formerly exactly defined value by a symbol creates a generalized problem (covering a whole family of the specific problems).

  • If you set $a$ to some value in $ax+3$, you get a more specific version, for example $5x+3$. If you further set $x$ to some value, you get a specific number out, like $5\cdot 6 + 3$.
  • In the other direction, if you turn $ax+3$ into $ax+t$, you can represent a whole family of (parameterized) functions including $ax+8$ and $ax+1$.

$t$ is the highest level parameter, $a$ is one lower and $x$ is the lowest. Since we usually only use a few such levels at a time, we like to use names for them instead of just saying "higher level" parameter. Variables are usually those that get adjusted on the lowest level, parameters are a level above and constants are those that we don't change or adjust in our current task, but they could be turned into even higher-level parameters (called hyperparameters) if we wanted to further generalize our problem or object.

Any function with multiple parameters can be turned into a higher-level function that just takes one parameter and gives you a new function which now takes one less parameter than the original. This is called currying. So your $f(a,x)=ax+3$ can be turned into a function which gives a new function for each $a$:

$$ F = (a \mapsto (x \mapsto (ax+3))) $$

So F(7) would be a function itself, $7x+3$.

If you are familiar with programming it is also similar to variable scoping, i.e. that values are defined in nested contexts. Functional programming uses these concepts even more heavily.

Which parameter you put on which level depends on the current problem at hand and the same problem can often be analyzed in multiple ways, i.e. by swapping parameters across levels (like in our example, interpreting $a$ as the lowest and $x$ as the higher-level parameter).