function [x,f] = findKer(n)
% Computes an element of Ker(L) where L = d^2/dx^2+1 with periodic b/c

A = zeros(n+1,n);

dx = 2*pi/n;

x = linspace(0,2*pi-dx,n);
dx = x(2)-x(1);
dxs = dx^2;

A(1,1) = 1;

A(2,1) = -2/dxs+1;
A(2,2) = 1/dxs;
A(2,n) = 1/dxs;

for j=3:n
    A(j,j-2) = 1/dxs;
    A(j,j-1) = -2/dxs+1;
    A(j,j) = 1/dxs;
end

A(n+1,1) = 1/dxs;
A(n+1,n-1) = 1/dxs;
A(n+1,n) = -2/dxs+1;

b = zeros(n+1,1);
b(1) = 1;

f = A\b;

end