8
$\begingroup$

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}]
$\endgroup$
0

3 Answers 3

7
$\begingroup$

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}}
$\endgroup$
7
$\begingroup$
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

$\endgroup$
6
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.