> ## 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-subtract",
  "feedback": "Description of the issue"
}
```

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

</AgentInstructions>

> Reference material for VECTOR_SUBTRACT function

# VECTOR_SUBTRACT

## VECTOR\_SUBTRACT

Returns an array that is the difference of two input arrays.

## Syntax

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

## Parameters

| Parameter | Description                                     | Supported input types                                                 |
| :-------- | :---------------------------------------------- | :-------------------------------------------------------------------- |
| `<array>` | The first array in the difference calculation.  | Any array of [numeric data types](/reference-sql/data-types#numeric). |
| `<array>` | The second array in the difference 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

`VECTOR_SUBTRACT` returns a result of type `ARRAY(BIGINT)` if the elements of `<array>` are of type `INT`, and returns a result of type `ARRAY(DOUBLE PRECISION)` if the elements are of type `REAL`. For other element types, `VECTOR_ADD` returns a result that matches the original element type, or follows Firebolt's [type conversion](/reference-sql/data-types#type-conversion) rules to convert them to compatible data types.

## Examples

**Example**

The following example subtracts the vector `[3, 4, -4]` from `[1, 5, 6]` by computing `1-3`, `5-4`, and `6-(-2)`, which yields `[-2, 1, 8]`:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
select vector_subtract([1, 5, 6], [3, 4, -2]) as res
```

**Returns**

| res (ARRAY(BIGINT)) |
| :------------------ |
| `{-2,1,8}`          |
