Andre, you mean that a1 and a2 are linearly dependent? then you divide a2 by a1 you obtain a matrix , the diagonal of that matrix contains the same element which is the scalar, here is an example :
a1=randn(10);
a2=a1*5;
f=diag(a2/a1);
F=f(1)
