function result = K_tau_21(x,y,t)

temp1 = t^2.*AiryKernel(x,y);

temp2 =t.*( partial_1_AiryKernel(x,y)-partial_2_AiryKernel(x,y));

temp3 = partial_1_partial_2_AiryKernel(x,y);

result = temp1 -temp2 - temp3;

%result = real(result*conjugation(x,y,t));

end

function K = partial_1_partial_2_AiryKernel(x,y) 

if size(x,2)>1 || size(y,2)>1
    error('RMT:kernel:shape','Input must be column vectors.'); 
end

[X,Y] = ndgrid(x,y);
K1 = -2*(-airy(1,x)*airy(y)'+airy(x)*airy(1,y)')./(X-Y).^3;
K2 = (airy(1,x)*(y.*airy(y))'-x.*airy(x)*airy(1,y)')./(X-Y);
K3= -(airy(x)*(y.*airy(y))'-airy(1,x)*airy(1,y)')./(X-Y).^2;
K4=(-x.*airy(x)*airy(y)'+airy(1,x)*airy(1,y)')./(X-Y).^2;
K=K1+K2+K3+K4;
ind = ~isfinite(K); X = X(ind);
if ~isempty(X), K(ind) = (X.^2.*airy(X).^2-2.*airy(X).*airy(1,X) - X.*airy(1,X).^2)./3; end
K = real(K);

end

function s = conjugation(x,y,t)
    s=exp(t*(x-y));
end