Consider the problem $-u''=f$, $u(a)=A$, $u(b)=B$. Everywhere, FEM seems to be introduced by using the case $(a,b,A,B) = (0,1,0,0)$, in which case the term $u'(a)v(a)-u'(b)v(b)$ resulting from integration by parts vanishes. If we divide $[a,b]$ into $a=x_0 < ... < x_n = b$, we'll end up solving an $(n-1)\times (n-1)$ system, fine and dandy.
How do you solve the above problem without convenient boundary conditions? I have tried searching and the few results I find are for higher dimensions, or I simply don't understand the answers. I have looked up several books on the matter and I can't find an answer.
Naively I would form a stiffness matrix $K=(K_{ij})_{i,j=0}^n$ and the load vector $b$ per the "usual" way, then add... something, somehow. In a case with BCs $au'(0) = \kappa_0(u(0)-g_0)$, $-au'(L) = \kappa_L(u(L)-g_L)$ the solution was to add $\kappa_0$ to $K_{00}$, $\kappa_L$ to $K_{nn}$, $\kappa_0 g_0$ to $b_0$ and $\kappa_L g_L$ to $b_n$. I don't know if that's at all applicable (I don't have any information about first derivatives) but those are the only special cases I see covered. On the other hand, $(n+1)\times (n+1)$ doesn't sound right since we know the values at the boundary and so we shouldn't want degrees of freedom there...
I really need help with this, I'd appreciate any advice, thanks.