{
  "tool": "matric-nqf4.maths_probability_table",
  "name": "Probability from a contingency table (CDU-GEN-NSC-400)",
  "answers": "P(A | B) and P(neither) for two subject choices over one class, refusing any probability outside [0 ; 1].",
  "degree": {
    "id": "competency:matric-nqf4",
    "code": "CDU-GEN-NSC-400",
    "name": "Senior Certificate (Amended) — exam-readiness programme (NQF 4 matric)",
    "version": "1.0.0"
  },
  "reference": "CAPS Grade 12 Mathematics, worked reference M16 (offline reconstruction); P(A∪B) = P(A) + P(B) − P(A∩B)",
  "endpoint": "/faculty/matric-nqf4/maths_probability_table",
  "feeSt": 1,
  "inputSchema": {
    "type": "object",
    "required": [
      "pan",
      "total",
      "nA",
      "nB",
      "nBoth"
    ],
    "properties": {
      "pan": {
        "type": "string",
        "description": "The student PAN — the degree must be held in one of its five slots",
        "pattern": "^[0-9 ]{16,19}$"
      },
      "total": {
        "type": "number",
        "description": "learners in the class",
        "minimum": 1,
        "maximum": 1000000
      },
      "nA": {
        "type": "number",
        "description": "take subject A",
        "minimum": 0,
        "maximum": 1000000
      },
      "nB": {
        "type": "number",
        "description": "take subject B",
        "minimum": 0,
        "maximum": 1000000
      },
      "nBoth": {
        "type": "number",
        "description": "take both",
        "minimum": 0,
        "maximum": 1000000
      }
    },
    "additionalProperties": false
  },
  "outputSchema": {
    "type": "object",
    "required": [
      "pAGivenB",
      "pNeither"
    ],
    "properties": {
      "pAGivenB": {
        "type": "number",
        "description": "P(A | B)"
      },
      "pNeither": {
        "type": "number",
        "description": "P(neither)"
      }
    },
    "additionalProperties": false
  },
  "example": {
    "total": 100,
    "nA": 60,
    "nB": 40,
    "nBoth": 30
  }
}