Why not use a function instead of a matrix?
def c(i,j):
if 0 <= i <= n and 0 <= j <= n:
return a[j] * b[i] - a[i] * b[j]
return 0
Then use c(i,j) instead of c[i,j].
Or you could first build the finite matrix,
calling it say cmatrix, and then
def c(i,j):
if 0 <= i <= n and 0 <= j <= n:
return cmatrix[i,j]
return 0
This would avoid save computation by
computing the cmatrix[i,j] only once,
and then just accessing matrix elements
when you call the function.
By the way, to access element (i,j) of a matrix,
it's faster to use c[i,j] than c[i][j]. Indeed, when
you do c[i][j], you are first extracting the whole
line i of the matrix, c[i], as a vector, and then
taking element j of that vector. You are wasting
time constructing a vector you won't need.
Also, if you want to change element (i,j) of the
matrix, a command such as
c[i,j] = 1
will work, but the version with c[i][j] won't work.