  We study the problem of one-dimensional regression of data points with
total-variation (TV) regularization (in the sense of measures) on the second
derivative, which is known to promote piecewise-linear solutions with few
knots. While there are efficient algorithms for determining such adaptive
splines, the difficulty with TV regularization is that the solution is
generally non-unique, an aspect that is often ignored in practice. In this
paper, we present a systematic analysis that results in a complete description
of the solution set with a clear distinction between the cases where the
solution is unique and those, much more frequent, where it is not. For the
latter scenario, we identify the sparsest solutions, i.e., those with the
minimum number of knots, and we derive a formula to compute the minimum number
of knots based solely on the data points. To achieve this, we first consider
the problem of exact interpolation which leads to an easier theoretical
analysis. Next, we relax the exact interpolation requirement to a regression
setting, and we consider a penalized optimization problem with a strictly
convex data-fidelity cost function. We show that the underlying penalized
problem can be reformulated as a constrained problem, and thus that all our
previous results still apply. Based on our theoretical analysis, we propose a
simple and fast two-step algorithm, agnostic to uniqueness, to reach a sparsest
solution of this penalized problem.
