1
$\begingroup$

A certain school offers 4 elective courses in physical education (A, B, C, D) and 4 elective courses in art (a, b, c, d). Students need to take 2 or 3 courses from these 8 courses, and at least 1 elective course is required for each type of elective course. How many different course selection options are there?

Category Discussion:

1.When 2 courses are selected, only one gate can be selected for each gate. There are 4 * 4=16 types

2.When 3 courses are selected, 2 courses will be selected for sports and 1 course will be selected for art; Or choose 1 sports course and 2 art courses. There are 4 * 6+6 * 4=48 options

So, there are a total of 16+48=64 selection methods

How to draw the corresponding tree diagram based on this?

$\endgroup$

1 Answer 1

2
$\begingroup$

I am not sure what exactly is desired. Here is a way to illustrate combinations:

s = CharacterRange["A", "D"];
a = CharacterRange["a", "d"];
two = Join @@ Outer[UndirectedEdge, s, a];
three1 = Join @@ Outer[UndirectedEdge, s, Subsets[a, {2}], 1];
three2 = Join @@ Outer[UndirectedEdge, a, Subsets[s, {2}], 1];
gtwo = Graph[two, VertexLabels -> "Name", 
   GraphLayout -> "BipartiteEmbedding"];
gthree1 = 
  Graph[three1, VertexLabels -> "Name", 
   GraphLayout -> "BipartiteEmbedding"];
gthree2 = 
  Graph[three2, VertexLabels -> "Name", 
   GraphLayout -> "BipartiteEmbedding"];
g = Graph[Join[two, three1, three2], VertexLabels -> "Name", 
   GraphLayout -> "BipartiteEmbedding"];

Visualizing:

res = Column[{Row[{"Number of 2 course options:", 
     Length[EdgeList[gtwo]]}], gtwo,
   Row[{"Number of 3 course options with 1 sport elective:", 
     Length[EdgeList[gthree1]]}], gthree1,
   Row[{"Number of 3 course options with 1 art elective:", 
     Length[EdgeList[gthree2]]}], gthree2,
   Row[{"Number of  2 or3 course options with at least 1 from each
type:", Length[EdgeList[g]]}], g
   }, Frame -> All]
   

enter image description here

$\endgroup$
2
  • $\begingroup$ This effect is very shocking! $\endgroup$
    – csn899
    Commented Jun 28, 2023 at 7:45
  • $\begingroup$ Thank you. What we need is this effect! $\endgroup$
    – csn899
    Commented Jun 28, 2023 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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