function [g]=givens(x,j,i)
% Function of Givens Rotation

% x: Input matrix
% i: Row affected by the zeroing operation
% j: Row to be zeroed (column 1)
% G: Givens rotation matrix 
g=eye(length(x)); %Initialize givens matrix
xi=x(i,1); %Identify the ordinate pair over which the rotation happens
xj=x(j,1);
r=sqrt(xi^2+xj^2); %Find length of vector r from origin to this point
%Populate rotation matrix with the necessary elements
cost=xi/r; 
sint=xj/r;
g(i,i)=cost;
g(i,j)=-sint;
g(j,i)=sint;
g(j,j)=cost;
end