# Complement for a Matrix

In a matrix, there are some non-zero elements same as: aA=

Also, there is a list such as:

list = {a, b, c, d, e, f, g, ii, jj, kk};


I want to access to elements of the list which are not in the matrix. (I mean: 'c','d','g','jj') I use Complement to this work:

Complement[aA, list]


But Complement doesn't work.

Flatten the matrix first.

aA = {{a, b, 0}, {e, f, 0}, {ii, 0, kk}};
list = {a, b, c, d, e, f, g, ii, jj, kk};
Complement[list, Flatten@aA]


{c, d, g, jj}

• I think for my goal, I must write: Complement[list, Flatten@aA] – Unbelievable Jun 3 '14 at 18:11
• @mostafa Oh yes, I didn't read carefully. – mfvonh Jun 3 '14 at 18:14