# how can I get the general expression of the outer product of n sublists?

There is a large list, with $$n$$ sublists of the same length (e.g. length is 3).

list1 = {{a_1, b_1, c_1}, {a_2, b_2, c_2},..., {a_n, b_n, c_n}}


If I need to regard $$n$$ as a parameter, how can I get the general expression of the outer product of the sublists?

Maybe we need to make some change to the code like this?

Outer[List, list1[[1]], list1[[2]], ...., list1[[n]], 1]


Should we use loop? or there will be better method?

• try Outer[List, Sequence @@ list1]?
– kglr
Sep 22 '21 at 16:02
• Also, I notice you're using Outer[List, ...]; just in case you plan to flatten this outer product, note the existence of Tuples[list1] Sep 22 '21 at 21:07

Define a function that generates a suitable list of triplets:

lists[n_] := Array[a[#1][#2] &, {n, 3}]

lists[2]
(* {{a[1][1], a[1][2], a[1][3]}, {a[2][1], a[2][2], a[2][3]}} *)


We can apply Outer to such a list e.g.

Outer[Times, ##] & @@ lists[2]
(* {{a[1][1] a[2][1], a[1][1] a[2][2],
a[1][1] a[2][3]}, {a[1][2] a[2][1], a[1][2] a[2][2],
a[1][2] a[2][3]}, {a[1][3] a[2][1], a[1][3] a[2][2],
a[1][3] a[2][3]}} *)