8

Considering I have three functions

f1 = -x + 1;

f2 = x - 1;

f3 = x + 3;

How can I find the intersection points of this functions? Thanks.

This didn't work

t = Solve[{k \[Element] f1, k \[Element] f2}, {k}]
Kuba
  • 136,707
  • 13
  • 279
  • 740
SuTron
  • 1,708
  • 1
  • 11
  • 21

3 Answers3

7

Here it is an overkill but maybe for general context it is worth to say this.

It does not work because fs are not regions:

f1 = ImplicitRegion[{y == -x + 1}, {x, y}]
f2 = ImplicitRegion[{y == x - 1}, {x, y}]

Solve[{k \[Element] f1, k \[Element] f2}, {k}]
{{k -> {1, 0}}}

I said an overkill because people usually do something like:

Solve[{y == -x + 1, y == x - 1}, {x, y}]
{{x -> 1, y -> 0}}
Kuba
  • 136,707
  • 13
  • 279
  • 740
7
Solve[{y == 1 - x, y == x - 1}, {x, y}]
Solve[{y == 1 - x, y == x + 3}, {x, y}]

seems the simplest approach. Another "overkill" region approach:

l1 = InfiniteLine[{{0, 1}, {1, 0}}];
l2 = InfiniteLine[{{0, -1}, {1, 0}}];
l3 = InfiniteLine[{{0, 3}, {1, 4}}];
ri1 = RegionIntersection[l1, l2];
ri2 = RegionIntersection[l1, l3];
Reduce[RegionMember[ri1, {x, y}]]
Reduce[RegionMember[ri2, {x, y}]]

yield y == 0 && x == 1 and y == 2 && x == -1 respectively

ubpdqn
  • 60,617
  • 3
  • 59
  • 148
6

Use Solve the neat way (and see here):

Solve[{f1 == f2}, x]
{*
{x -> 1}
*}
Solve[{f1 == f3}, x]
{*
{x -> -1}
*}

Plot[{f1, f2, f3}, {x, -5, 5}, PlotLegends -> "Expressions", 
Epilog -> {Red, PointSize[Large], Point[{{1, 0}, {-1, 2}}]}]

enter image description here