6
$\begingroup$

I'm a recreational user who loves using the product.

I'm looking for a strategy to solve the following question using Mathematica.

The question is from a sample actuarial exam. I can solve this with pencil and paper, but I'm fascinated (and stumped) about how to solve this in Mathematica. Any hints? Thanks!

THE QUESTION: An auto insurance company has 10,000 policyholders.

Each policyholder is classified as (i) young or old; (ii) male or female; and (iii) married or single.

Of these policyholders,

  • 3000 are young,
  • 4600 are male, and
  • 7000 are married.

The policyholders can also be classified as

  • 1320 young males,
  • 3010 married males, and
  • 1400 young married persons.

Finally, 600 of the policyholders are young married males.

Calculate the number of the company’s policyholders who are young, female, and single.

$\endgroup$

1 Answer 1

10
$\begingroup$

The tedious part of this is writing all the equations

ages = {young, old};
sexes = {female, male};
wed = {single, married};

equations = {Sum[n[young, j, k], {j, sexes}, {k, wed}] == 
    3000,
   Sum[n[i, male, k], {i, ages}, {k, wed}] == 4600,
   Sum[n[i, j, married], {i, ages}, {j, sexes}] == 7000,
   Sum[n[young, male, k], {k, wed}] == 1320,
   Sum[n[i, male, married], {i, ages}] == 3010,
   Sum[n[young, j, married], {j, sexes}] == 1400,
   n[young, male, married] == 600};

Solve[equations]
(* {{n[old, female, married] -> 3190, 
  n[old, male, married] -> 2410, n[old, male, single] -> 870, 
  n[young, female, married] -> 800, n[young, female, single] -> 880, 
  n[young, male, married] -> 600, n[young, male, single] -> 720}} *)

There might be a slightly more concise way of expressing this.

$\endgroup$
2
  • $\begingroup$ Thank you @mikado! That's an interesting approach. A remarkable thing is this solution makes no use of the population size (10,000), which I imagined would be required. May I ask, in the interest of my learning, where do the n[...] terms come from? I've not seen that in the language. I use N[...] and ...// N all the time, but n[...]? $\endgroup$ Jan 26 at 21:32
  • 2
    $\begingroup$ n is simply a variable name. I could have used any Mathematica identifier x, number,.... Assuming I've not made a mistake, I have 7 equations in 7 unknowns. The number of old, single females is not mentioned, but could be calculated by including the grand total (which I omitted inadvertently). $\endgroup$
    – mikado
    Jan 26 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.