SEARCH HOME
 Math Central Quandaries & Queries
 Question from Colin: Hi, I want to define an equation for calculating the total combination of roles that a user can be assign in a system. Here is the background: There are two types of roles that a user can be assigned. These are object roles and data roles. There must be at least 1 object and 1 data role in the system. A user must be assigned at least 1 object role and at least 1 data role. A user can be assigned as many object roles and data roles as are created in the system. There is no upper limit to the number of roles that a user can be assigned except for the total number of object roles and data roles that exist. The number of object roles and data roles in the system are independent. Can someone please assist? Thanks.

Hi Colin,

Suppose there are $m$ object roles and $n$ data roles in the system. There are $m$ way a user can be assigned an object role and $n$ ways a user can be assigned a data role and hence there are $m \timers n$ ways a user can be assigned an object role and a data role.

The user can then be assigned any subset of the remaining $m - 1 + n - 1 = m + n - 2$ roles. A set with $k$ elements has $2^k$ subsets so the number of ways a user can be assigned roles is

$m \times n \times 2^{m + n - 2}.$

Penny

Math Central is supported by the University of Regina and The Pacific Institute for the Mathematical Sciences.