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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.firebolt.io/feedback

```json
{
  "path": "/reference-sql/functions-reference/vector/vector-inner-product",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

> Reference material for VECTOR_INNER_PRODUCT function

# VECTOR_INNER_PRODUCT

## VECTOR\_INNER\_PRODUCT

Returns the inner product, also known as the dot or scalar product, between two vectors. The inner product measures how closely two vectors align with each other, both in magnitude and the cosine of the angle between them. It is calculated by multiplying the corresponding elements of the vectors and then summing the results.

If the vectors have similar directions and large magnitudes, the inner product has a large positive value. If they are orthogonal, the inner product is zero, regardless of magnitude. If they point in roughly opposite directions, and at least one has a small magnitude, the inner product is small and negative.

**Alias:** `inner_product` (aligned with pgvector for compatibility)

## Syntax

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
VECTOR_INNER_PRODUCT(<array>, <array>)
```

## Parameters

| Parameter | Description                                             | Supported input types                                                 |
| :-------- | :------------------------------------------------------ | :-------------------------------------------------------------------- |
| `<array>` | The first array used in the inner product calculation.  | Any array of [numeric data types](/reference-sql/data-types#numeric). |
| `<array>` | The second array used in the inner product calculation. | Any array of [numeric data types](/reference-sql/data-types#numeric). |

## Notes

Both input `array` arguments must have the same number of elements.

## Return Type

`DOUBLE`

## Examples

**Example**

The following code returns the inner product of two vectors that have similar directions and magnitudes:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT VECTOR_INNER_PRODUCT([1, 2], [3, 4]) AS product;
```

**Returns**

| product (DOUBLE PRECISION) |
| :------------------------- |
| 11                         |

**Example**

The following code returns the inner product of two vectors that are orthogonal to each other:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT VECTOR_INNER_PRODUCT([3, 4], [-4, 3]) AS product;
```

**Returns**

| product (DOUBLE PRECISION) |
| :------------------------- |
| 0                          |

**Example**

The following code returns the inner product of two vectors that are pointing in very different directions that are not orthogonal:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT VECTOR_INNER_PRODUCT([3, 4], [4, -2]) AS product;
```

**Returns**

| product (DOUBLE PRECISION) |
| :------------------------- |
| 4                          |
