# Stiffness matrix on finite element method: singular or not?

I have to solve the problem $$\begin{split} -\Delta u +u=& f \text{ on } \Omega \\ u=& g \text{ on }\partial \Omega\\ \end{split}$$ I don't specify $f,g,\Omega$ since they are not important for my question. Writing the weak formulation: $$\sum_{i=1}^{N_{h}} u_{i} \Big(\int_{\Omega}\nabla\varphi_{i}\cdot\nabla\varphi_{j}\, dx+\int_{\Omega}\varphi_{i}\varphi_{j}\, dx\Big)=\int_{\Omega}f\varphi_{j}\, dx\quad\forall j=1,\dots,N_{h}$$ with $\{\varphi_{i} \} _{i=1,...N_{h}}$ is the basis made by Lagrange polynomials for the finite-dimensional space $V_{h}$, $\dim(V_{h})=N_{h}$.
So this is equivalent to the linear system $Au=f$, with $A$ is my stiffness matrix.
My question is: before considering the boundary condition should this stiffness matrix be singular? I think so because the problem must have infinite solution if there are no boundary condition, but writing the algorithm on MATLAB my matrix is very far from being singular.
Consider that imposing the boundary conditions and continuing the exercise I have convergence so I don't think to have made mistakes.

When you don't specify boundary conditions in FEM, you are (implicitly) assuming so called natural boundary conditions. For your problem these are $$\frac{\partial u}{\partial n} = 0$$ Now, if the operator was simply $-\Delta$ then the matrix would be singular (and the kernel will be the vector of all constants). But because of the additional term it is not in your case. By the way, be careful with words - actually, stiffness matrix is the name for $(\nabla u, \nabla v)$ while for $(u,v)$ it is called mass matrix. So, in your case, the matrix should be simple called the system matrix.