> ## Documentation Index
> Fetch the complete documentation index at: https://docsa.stemfard.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using Stemfard learning pathways to guide students

> Enable learning pathways in Stemfard to surface related math concepts and guide students through progressive topic discovery after each result.

Learning pathways help your application suggest related mathematical topics to students after they solve a problem. Rather than leaving learners at a dead end after receiving a result, you can surface a curated list of connected concepts — the next topics to explore, prerequisites to revisit, or complementary techniques to try. This turns a single API call into the starting point for a guided learning journey.

## What learning pathways are

When you set `learning_pathways: true` in a request, the API includes a `learning_pathways` array in the response. Each entry links to a related mathematical concept or Stemfard endpoint that naturally extends the topic the student just worked on. For example, after solving a matrix multiplication problem, pathways might point toward determinants, matrix inverses, or eigenvalues.

The `related` field works differently: setting `related: true` returns an array of other Stemfard API endpoints that are closely related to the one you called. This is useful for building navigation within your application — showing students what other operations are available that relate to what they just did.

| Field               | Type      | What it returns                                                    |
| ------------------- | --------- | ------------------------------------------------------------------ |
| `learning_pathways` | `boolean` | Conceptual learning topics to explore next                         |
| `related`           | `boolean` | Other Stemfard API endpoints in the same mathematical neighborhood |

## Enabling learning pathways

Add `learning_pathways: true` (and optionally `related: true`) to any request body:

```json theme={null}
{
  "a": [[1, 2], [3, 4]],
  "b": [[5, 6], [7, 8]],
  "api_level": "standard",
  "learning_pathways": true,
  "related": true
}
```

## Complete example

The following request multiplies two matrices and asks for both learning pathways and related endpoints:

<CodeGroup>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/matmul \
    --header 'Authorization: Bearer <your-api-key>' \
    --header 'Content-Type: application/json' \
    --data '{
      "a": [[1, 2], [3, 4]],
      "b": [[5, 6], [7, 8]],
      "api_level": "standard",
      "result_name": "product",
      "learning_pathways": true,
      "related": true
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/matmul',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer <your-api-key>',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        a: [[1, 2], [3, 4]],
        b: [[5, 6], [7, 8]],
        api_level: 'standard',
        result_name: 'product',
        learning_pathways: true,
        related: true,
      }),
    }
  );
  const data = await response.json();
  ```
</CodeGroup>

**Sample response**

```json theme={null}
{
  "result_name": "product",
  "result": [[19, 22], [43, 50]],
  "steps": { "html": "..." },
  "learning_pathways": [
    {
      "title": "Matrix determinants",
      "description": "Compute the scalar value that summarizes a square matrix's properties.",
      "href": "/api/v1/mathematics/linear-algebra/matrix-determinant"
    },
    {
      "title": "Matrix inverse",
      "description": "Find the matrix that undoes a transformation.",
      "href": "/api/v1/mathematics/linear-algebra/matrix-inverse"
    },
    {
      "title": "Eigenvalues and eigenvectors",
      "description": "Discover the fundamental directions that a matrix scales without rotating.",
      "href": "/api/v1/mathematics/linear-algebra/eigenvalues"
    }
  ],
  "related": [
    {
      "title": "Matrix addition",
      "href": "/api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/add"
    },
    {
      "title": "Matrix subtraction",
      "href": "/api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/subtract"
    },
    {
      "title": "Matrix statistics",
      "href": "/api/v1/mathematics/linear-algebra/matrix-operations/matrix-statistics"
    }
  ]
}
```

## Using pathways in an educational app

Once you have the `learning_pathways` array, you can render it as a "what to explore next" section. Below is a pattern that works well after displaying a result.

```javascript theme={null}
async function solveAndRenderPathways(matrixA, matrixB) {
  const response = await fetch(
    'https://api.stemfard.com/api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/matmul',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer <your-api-key>',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        a: matrixA,
        b: matrixB,
        api_level: 'standard',
        learning_pathways: true,
        related: true,
      }),
    }
  );

  const data = await response.json();

  // Display the result
  displayResult(data.result);

  // Render pathway cards
  const pathwayList = document.getElementById('next-topics');
  pathwayList.innerHTML = '';

  for (const pathway of data.learning_pathways) {
    const card = document.createElement('a');
    card.href = `/topics${pathway.href}`;
    card.className = 'pathway-card';
    card.innerHTML = `
      <h4>${pathway.title}</h4>
      <p>${pathway.description}</p>
    `;
    pathwayList.appendChild(card);
  }
}
```

## Pathway use cases

<AccordionGroup>
  <Accordion title="Progressive curriculum sequencing" icon="graduation-cap">
    Use learning pathways to drive a structured curriculum. After a student completes a problem at one level, fetch the pathways and present only those that match the student's current progress tier. Store completed topics in your own database and filter the pathway list to surface the most relevant next step.

    ```javascript theme={null}
    const nextTopics = data.learning_pathways.filter(
      (p) => !student.completedTopics.includes(p.href)
    );
    ```
  </Accordion>

  <Accordion title="Adaptive review suggestions" icon="rotate-left">
    If a student's solution contains errors, use pathways to suggest prerequisite topics for review rather than pointing forward. You can combine pathway data with your own difficulty scoring to decide whether to route a student forward or backward through the curriculum.
  </Accordion>

  <Accordion title="Topic exploration mode" icon="compass">
    Present the full `learning_pathways` array in a visual map so students can freely explore connected concepts. Pair this with the `related` endpoints array to show which API operations are available for each topic, letting curious learners dive deeper on their own terms.
  </Accordion>

  <Accordion title="Sidebar recommendations" icon="sidebar">
    Display related endpoints from the `related` array as a sidebar panel while a student is actively working. This gives immediate access to complementary operations — for example, showing matrix statistics endpoints alongside an arithmetic result — without interrupting the current task.
  </Accordion>
</AccordionGroup>

## Difference between `learning_pathways` and `related`

Both fields help students navigate, but they serve different purposes:

* **`learning_pathways`** points to *mathematical concepts* — the next things to learn. These are topic-level suggestions designed to guide curriculum progression.
* **`related`** points to *other Stemfard API endpoints* in the same operational family. These are practical suggestions for exploring what else the API can compute in the same domain.

Use `learning_pathways` to drive curriculum flow and student growth. Use `related` to build discoverable API navigation within your interface.
