# Function composition

**URL:** <https://community.wolfram.com/t/function-composition/2306>\
**Category:** Questions\
**Tags:** mathematica\
**Created:** [June 1, 2014, 5:41pm UTC](https://community.wolfram.com/t/function-composition/2306 "2014-06-01T17:41:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joseasd](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@joseasd](https://community.wolfram.com/u/joseasd)\
**Post date:** [June 1, 2014, 5:41pm UTC](https://community.wolfram.com/t/function-composition/2306/1 "2014-06-01T17:41:00Z")

</div>

Hi.

I’m kinda new to this and just learning all I can to compute everything with Mathematica.  
How can i compute this:

f(x) = 3x - 5  
g(x) = 2 - x^2

(F o G) (x) ?

I’ve tried with:

```auto
f[x]=3x-5
g[x]=2-x^2

```

Composition [f,g], but I’m just getting:

```auto
f[2 - x^2]

```

Any help would be appreciated, Thanks.

---

<div class="post-metadata">

**Author:** ![sukrause](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/sukrause/32/41348_2.png) [@sukrause](https://community.wolfram.com/u/sukrause)\
**Post date:** [June 1, 2014, 6:28pm UTC](https://community.wolfram.com/t/function-composition/2306/2 "2014-06-01T18:28:28Z")

</div>

```auto
In[42]:= Clear[f, g]
f[x_] := 3 x - 5
g[x_] := 2 - x^2

In[45]:= f[g[o]]
Out[45]= -5 + 3 (2 - o^2)

In[46]:= Composition[f, g][q]
Out[46]= -5 + 3 (2 - q^2)

```

does not do it? Syntax matters …

---

<div class="post-metadata">

**Author:** ![melvyn11](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@melvyn11](https://community.wolfram.com/u/melvyn11)\
**Post date:** [June 1, 2014, 6:31pm UTC](https://community.wolfram.com/t/function-composition/2306/3 "2014-06-01T18:31:25Z")

</div>

```auto
f[x_]:=3x-5;g[x_]:=2-x^2;
Composition[f,g][x]

```
