# Convexity of linear regression

I know that linear regression leads to a convex optimization problem. I'd like to visually show this with a simple example. Assume that there are two parameters (x and y) and a single data point <1, 1> with 2 as the y value (no intercept term. Then the cost function becomes

$$(x+y-2)^2$$

However if you plot this function you will get the figure which contains more than one minimal point. Where is the problem in this example? Thanks

2 parameters and a single data point is not strictly convex because the rank of the matrix of observations and predictors is deficient. Indeed, as you observe, there is a line of many "equally good" solutions, and this is because for any choice of $x$ there is a corresponding $y$ which achieves the minimum: how many points satisfy $x+y=2$?
$$(x+y-2)^2=0$$ $$x+y=2$$ $$y=2-x$$
You can pick any $x$, and get a corresponding $y$, i.e. there's no unique solution. With two unknowns and one observation, there's not going to be a unique solution