Skip to main content
1 of 2
user64494
  • 30.4k
  • 4
  • 31
  • 62

A long, but understandable, way is as follows. First,

A = Expand[a + c (d - a b d) + e c (a + b) f + b - 1];
var = Variables[A];

Second, we form the list of the terms of A by

mono = MonomialList[A, var]

{-a b c d, a c e f, a, b c e f, b, c d, -1}

Third, we create the list of the lists of degrees of each term with respect to each variable through

Map[Exponent[#, var] &, mono]

{{1, 1, 1, 1, 0, 0}, {1, 0, 1, 0, 1, 1}, {1, 0, 0, 0, 0, 0}, {0, 1, 1, 0, 1, 1}, {0, 1, 0, 0, 0, 0}, {0, 0, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0}}

and then we find the total degree of each term by

Map[Total[#] &, Map[Exponent[#, var] &, mono]]

{4, 4, 1, 4, 1, 2, 0}

Fourth, we choose the terms of the total degree less than or equal to one and add those terms

Select[mono, Total[#] &@Exponent[#, var] <= 1 &] // Total

-1 + a + b

Don't shoot the pianist: he plays as he can.

user64494
  • 30.4k
  • 4
  • 31
  • 62