function [ridge_smoother] = get_ridge_smoother(X, lambda)

    [n, p] = size(X); % number of observations
    
    if (p < n)
        hSigma = X' * X / n; % sample covariance matrix
        ridge_smoother = X * ((hSigma + lambda * eye(p)) \ X') / n; % ridge smoother using primal form
    else
        gram_mat = X * X' / n; % gram matrix
        ridge_smoother = X * X' / (gram_mat + lambda * eye(n)) / n; % ridge smoother using dual form
    end

    
end