operation parameter, and six individual endpoints — one per operation. All endpoints accept two input matrices a and b (or a and a scalar for element-wise operations) and the full set of common request parameters.
Combined endpoint
Use this endpoint to run any arithmetic operation in a single request by setting theoperation field.
POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic
Parameters
number[][]
required
The first input matrix, expressed as an array of row arrays. Default:
[[5, 1, 6], [3, 4, 5], [6, 4, 8]].number[][] | number
required
The second input matrix or scalar. For element-wise operations,
b must have the same dimensions as a. For matmul, the number of columns in a must equal the number of rows in b. Default: [[-4, -2, 6], [4, 7, -3], [7, -3, 5]].string
required
The arithmetic operation to perform. Accepted values:
"all"— run all operations and return all results"add"— element-wise addition"subtract"— element-wise subtraction"multiply-ew"— element-wise (Hadamard) multiplication"divide-ew"— element-wise division"raise-ew"— element-wise power (each element ofaraised to the corresponding element ofb)"matmul"— standard matrix multiplication
string
default:"ans"
Name assigned to the computed result in the response.
string
default:"detailed"
Response verbosity:
"lite", "standard", or "detailed".boolean
default:"true"
Include background theory alongside solution steps.
string[]
default:"[\"\"]"
Format for step content:
"html", "latex", or "speech".integer | null
default:"null"
Decimal precision for rounding the result. Pass
null for full precision.boolean
default:"false"
Apply
decimals rounding to intermediate step values.boolean
default:"true"
Include normalized request parameters in the response.
boolean
default:"true"
Include curated learning resource links in the response.
Include links to related Stemfard endpoints in the response.
boolean
default:"true"
Include a description of the result object’s properties.
Example — matrix multiplication via the combined endpoint
200
Individual operation endpoints
Each operation has its own focused endpoint. These endpoints do not accept anoperation field — the operation is determined by the path. All accept a, b, and the common parameters.
POST .../matrix-arithmetic/add — element-wise addition
POST .../matrix-arithmetic/add — element-wise addition
Adds two matrices element by element. Example
a and b must have identical dimensions.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/addnumber[][]
required
First input matrix.
number[][]
required
Second input matrix. Must have the same dimensions as
a.string
default:"ans"
Name for the result in the response.
string
default:"detailed"
Response verbosity:
"lite", "standard", or "detailed".integer | null
default:"null"
Decimal precision for the result.
200
POST .../matrix-arithmetic/subtract — element-wise subtraction
POST .../matrix-arithmetic/subtract — element-wise subtraction
Subtracts Example
b from a element by element. Both matrices must have identical dimensions.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/subtractnumber[][]
required
First input matrix (minuend).
number[][]
required
Second input matrix (subtrahend). Must have the same dimensions as
a.string
default:"ans"
Name for the result in the response.
string
default:"detailed"
Response verbosity:
"lite", "standard", or "detailed".integer | null
default:"null"
Decimal precision for the result.
200
POST .../matrix-arithmetic/multiply-ew — element-wise multiplication
POST .../matrix-arithmetic/multiply-ew — element-wise multiplication
Computes the Hadamard (element-wise) product of Example
a and b. Each element at position (i, j) in the result equals a[i][j] × b[i][j]. Both matrices must have identical dimensions.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/multiply-ewnumber[][]
required
First input matrix.
number[][]
required
Second input matrix. Must have the same dimensions as
a.string
default:"ans"
Name for the result in the response.
string
default:"detailed"
Response verbosity:
"lite", "standard", or "detailed".integer | null
default:"null"
Decimal precision for the result.
200
POST .../matrix-arithmetic/divide-ew — element-wise division
POST .../matrix-arithmetic/divide-ew — element-wise division
Divides each element of Example
a by the corresponding element of b. Both matrices must have identical dimensions. Division by zero in b will produce an error.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/divide-ewnumber[][]
required
Numerator matrix.
number[][]
required
Denominator matrix. Must have the same dimensions as
a. No element may be zero.string
default:"ans"
Name for the result in the response.
string
default:"detailed"
Response verbosity:
"lite", "standard", or "detailed".integer | null
default:"null"
Decimal precision for the result.
200
POST .../matrix-arithmetic/raise-ew — element-wise power
POST .../matrix-arithmetic/raise-ew — element-wise power
Raises each element of Example
a to the power of the corresponding element of b. The result at position (i, j) equals a[i][j] ^ b[i][j]. Both matrices must have identical dimensions.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/raise-ewnumber[][]
required
Base matrix.
number[][]
required
Exponent matrix. Must have the same dimensions as
a.string
default:"ans"
Name for the result in the response.
string
default:"detailed"
Response verbosity:
"lite", "standard", or "detailed".integer | null
default:"null"
Decimal precision for the result.
200
POST .../matrix-arithmetic/matmul — matrix multiplication
POST .../matrix-arithmetic/matmul — matrix multiplication
Performs standard matrix multiplication (dot product). The number of columns in Example
a must equal the number of rows in b. If a is m × k and b is k × n, the result is m × n.POST /api/v1/mathematics/linear-algebra/matrix-operations/matrix-arithmetic/matmulnumber[][]
required
Left-hand matrix. An
m × k matrix.number[][]
required
Right-hand matrix. A
k × n matrix. The number of rows must equal the number of columns in a.string
default:"ans"
Name for the result in the response.
string
default:"detailed"
Response verbosity:
"lite", "standard", or "detailed".integer | null
default:"null"
Decimal precision for the result.
200
Matrix multiplication is not commutative —
a × b is not equal to b × a in general. Make sure you pass the matrices in the correct order for your use case.