# How to get this table of (x-a)*(x-b), where a > b?

I am trying get a table of (x-a)*(x-b), where a > b. I tried

Table[{(x - a) (x - b)}, {a, 5}, {b, 5}]


If I used,

Table[{(x - a) (x - b)}, {a, 5}, {b, 5}, {a > b}]


I can not get the result. How can I get the correct result?

• One way is Flatten@Table[{(x - a) (x - b)}, {b, 5}, {a, b+1, 5}] – Thies Heidecke Jul 4 at 1:21
• @ThiesHeidecke Thank you very much. – minhthien_2016 Jul 4 at 1:56
• @ThiesHeidecke How about (x-a)*(x-b)*(x-c), where a > b>c ? – minhthien_2016 Jul 14 at 2:48
• You can always refer to earlier table variables to define the range start/end of all following variables, so the previous answer should generalize to the a,b,c case: Flatten@Table[{(x - a) (x - b) (x - c)}, {c, 5}, {b, c+1, 5}, {a, b+1, 5}]. – Thies Heidecke Jul 15 at 0:00
• Thank you very much. – minhthien_2016 Jul 15 at 1:02