In \sum_{i=1}^{4}((x_{i}-x_{i-1})^2+k_ix_i) you have x_0 term, so I assume that indices are cyclic and x_0=x_4. You have to expand \sum_{i=1}^{4}(x_{i}-x_{i-1})^2 and then write it as (Einstein convention used) A_{ij}x_i x_j. Notice that as x_i x_j=x_j x_i, matrix \mathbb{A} is not unique...